Skip to content

Commit

Permalink
Upgrade VSCode dependency to version 1.55
Browse files Browse the repository at this point in the history
Signed-off-by: Tal Wertheimer <[email protected]>
  • Loading branch information
Tal Wertheimer authored and Tal Wertheimer committed Dec 13, 2023
1 parent 16c2111 commit 745ecf2
Show file tree
Hide file tree
Showing 16 changed files with 28 additions and 166 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
"@types/sinon": "^9.0.11",
"@types/tmp": "^0.2.0",
"@types/underscore": "^1.11.15",
"@types/vscode": "^1.50.0",
"@types/vscode": "^1.55.0",
"@types/yauzl": "^2.9.1",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^4.18.0",
Expand Down
4 changes: 2 additions & 2 deletions src/assistant/diagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const cancellationToken = new CancellationToken();

function getRelevantRange(
document: vscode.TextDocument,
visibleRanges: vscode.Range[]
visibleRanges: readonly vscode.Range[]
): vscode.Range | undefined {
const firstEditingPosition = changesTrackMap.get(document.uri);
const visibleRange = visibleRanges.reduce((accumulator, currentValue) =>
Expand All @@ -79,7 +79,7 @@ function getRelevantRange(
async function refreshDiagnostics(
document: vscode.TextDocument,
diagnosticsCollection: vscode.DiagnosticCollection,
visibleRanges: vscode.Range[]
visibleRanges: readonly vscode.Range[]
): Promise<void> {
cancellationToken.cancel();
const lock = await mutex.acquire();
Expand Down
5 changes: 5 additions & 0 deletions src/authentication/TabnineAuthenticationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,19 +125,24 @@ export default class TabnineAuthenticationProvider
if (!last && current) {
this.sessionsChangeEventEmitter.fire({
added: [toSession(current)],
removed: undefined,
changed: undefined
});
}

if (last && !current) {
this.sessionsChangeEventEmitter.fire({
removed: [toSession(last)],
added: undefined,
changed: undefined
});
}

if (last && current) {
this.sessionsChangeEventEmitter.fire({
removed: [toSession(last)],
added: [toSession(current)],
changed: undefined
});
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/debounceCompletions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as vscode from "vscode";
import { Capability, isCapabilityEnabled } from "./capabilities/capabilities";
import getInlineCompletionItems from "./getInlineCompletionItems";
import TabnineInlineCompletionItem from "./inlineSuggestions/tabnineInlineCompletionItem";
import { sleep, timed } from "./utils/utils";

const ALPHA_ONE_SECOND_DEBOUNCE = 1000;
Expand All @@ -11,7 +10,7 @@ export default async function debounceCompletions(
position: vscode.Position,
token: vscode.CancellationToken
): Promise<
vscode.InlineCompletionList<TabnineInlineCompletionItem> | undefined
vscode.InlineCompletionList | undefined
> {
const { time, value: current } = await timed(() =>
getInlineCompletionItems(document, position, token)
Expand Down
2 changes: 1 addition & 1 deletion src/getInlineCompletionItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default async function getInlineCompletionItems(
document: vscode.TextDocument,
position: vscode.Position,
cancellationToken: vscode.CancellationToken
): Promise<vscode.InlineCompletionList<TabnineInlineCompletionItem>> {
): Promise<vscode.InlineCompletionList> {
const response = await runCompletion({
document,
position,
Expand Down
1 change: 0 additions & 1 deletion src/inlineSuggestions/tabnineInlineCompletionItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export default class TabnineInlineCompletionItem extends InlineCompletionItem {

snippetContext?: SnippetContext;

insertText?: string;

constructor(
text: string,
Expand Down
2 changes: 1 addition & 1 deletion src/lookAheadSuggestion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export async function getLookAheadSuggestion(
{ range, text }: SelectedCompletionInfo,
position: Position,
cancellationToken: CancellationToken
): Promise<InlineCompletionList<TabnineInlineCompletionItem>> {
): Promise<InlineCompletionList> {
const textAtRange = document.getText(range);
const isContainsCompletionInfo = text.startsWith(textAtRange);

Expand Down
3 changes: 1 addition & 2 deletions src/provideInlineCompletionItems.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as vscode from "vscode";
import TabnineInlineCompletionItem from "./inlineSuggestions/tabnineInlineCompletionItem";
import { completionIsAllowed } from "./provideCompletionItems";
import { getShouldComplete } from "./inlineSuggestions/documentChangesTracker";
import {
Expand All @@ -19,7 +18,7 @@ export default async function provideInlineCompletionItems(
context: vscode.InlineCompletionContext,
token: vscode.CancellationToken
): Promise<
vscode.InlineCompletionList<TabnineInlineCompletionItem> | undefined
vscode.InlineCompletionList | undefined
> {
try {
clearCurrentLookAheadSuggestion();
Expand Down
6 changes: 3 additions & 3 deletions src/reportSuggestionShown.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import * as vscode from "vscode";
import TabnineInlineCompletionItem from "./inlineSuggestions/tabnineInlineCompletionItem";
import suggestionShown from "./binary/requests/suggestionShown";
import { ResultEntry } from "./binary/requests/requests";
import TabnineInlineCompletionItem from "./inlineSuggestions/tabnineInlineCompletionItem";

let lastShownSuggestion: ResultEntry | undefined | null;

export default function reportSuggestionShown(
document: vscode.TextDocument,
completions?: vscode.InlineCompletionList<TabnineInlineCompletionItem>
completions?: vscode.InlineCompletionList
): void {
const item = completions?.items[0]?.suggestionEntry;
const item = (completions?.items[0] as TabnineInlineCompletionItem ).suggestionEntry;

if (item && !lastShownSuggestion?.new_prefix.endsWith(item.new_prefix)) {
void suggestionShown({
Expand Down
1 change: 1 addition & 0 deletions src/tabnineChatWidget/webviews/getIcon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const LOGO_BY_THEME = {
[ColorThemeKind.Dark]: "tabnine-logo-dark.svg",
[ColorThemeKind.Light]: "tabnine-logo-light.svg",
[ColorThemeKind.HighContrast]: "logo.svg",
[ColorThemeKind.HighContrastLight]: "logo-light.svg",
};

export function getIcon(context: ExtensionContext, view: Webview) {
Expand Down
3 changes: 1 addition & 2 deletions src/test/suite/utils/completion.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { SelectionStateRequest } from "../../../binary/requests/setState";
import { CompletionArguments } from "../../../CompletionArguments";
import { sleep } from "../../../utils/utils";
import { TAB_OVERRIDE_COMMAND } from "../../../globals/consts";
import TabnineInlineCompletionItem from "../../../inlineSuggestions/tabnineInlineCompletionItem";
import provideInlineCompletionItems from "../../../provideInlineCompletionItems";

// eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-argument
Expand Down Expand Up @@ -117,7 +116,7 @@ export async function triggerSelectionAcceptance(): Promise<void> {
export async function getInlineCompletions(
editor: vscode.TextEditor
): Promise<
vscode.InlineCompletionList<TabnineInlineCompletionItem> | undefined
vscode.InlineCompletionList | undefined
> {
return provideInlineCompletionItems(
editor.document,
Expand Down
3 changes: 3 additions & 0 deletions src/test/suite/utils/preReleaseInstaller.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ export async function runInstallation(
export function getContext(contextGetMocks: ContextGetMocks): ExtensionContext {
return {
globalState: {
keys() {
return [];
},
get: (key: string) => contextGetMocks[key],
update: updateGlobalState,
},
Expand Down
1 change: 1 addition & 0 deletions src/utils/logo.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const LOGO_BY_THEME = {
[ColorThemeKind.Light]: "logo-dark.svg",
[ColorThemeKind.Dark]: "logo-light.svg",
[ColorThemeKind.HighContrast]: "logo.svg",
[ColorThemeKind.HighContrastLight]: "logo-light.svg",
};

export function getLogoPath(context: ExtensionContext): string {
Expand Down
5 changes: 3 additions & 2 deletions src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ export function trimEnd(str: string, suffix: string): string {
return str.replace(new RegExp(`${escapeRegExp(suffix)}$`), "");
}

export function escapeTabStopSign(value: string): string {
return value.replace(new RegExp("\\$", "g"), "\\$");
export function escapeTabStopSign(value: string | vscode.SnippetString): string {
const val = typeof value === "string"? value : value.value;
return val.replace(new RegExp("\\$", "g"), "\\$");
}

export function isMultiline(text?: string): boolean {
Expand Down
145 changes: 0 additions & 145 deletions src/vscode.proposed.inlineCompletions.d.ts

This file was deleted.

8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,10 @@
resolved "https://registry.yarnpkg.com/@types/underscore/-/underscore-1.11.15.tgz#29c776daecf6f1935da9adda17509686bf979947"
integrity sha512-HP38xE+GuWGlbSRq9WrZkousaQ7dragtZCruBVMi0oX1migFZavZ3OROKHSkNp/9ouq82zrWtZpg18jFnVN96g==

"@types/vscode@^1.50.0":
version "1.55.0"
resolved "https://registry.yarnpkg.com/@types/vscode/-/vscode-1.55.0.tgz#58cfbebbd32b3e374e07e7858b1fd0e92b1a1d2b"
integrity sha512-49hysH7jneTQoSC8TWbAi7nKK9Lc5osQNjmDHVosrcU8o3jecD9GrK0Qyul8q4aGPSXRfNGqIp9CBdb13akETg==
"@types/vscode@^1.55.0":
version "1.85.0"
resolved "https://registry.yarnpkg.com/@types/vscode/-/vscode-1.85.0.tgz#46beb07f0f626665b52d1e2294382b2bc63b602e"
integrity sha512-CF/RBon/GXwdfmnjZj0WTUMZN5H6YITOfBCP4iEZlOtVQXuzw6t7Le7+cR+7JzdMrnlm7Mfp49Oj2TuSXIWo3g==

"@types/yauzl@^2.9.1":
version "2.9.1"
Expand Down

0 comments on commit 745ecf2

Please sign in to comment.