Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7252,7 +7252,7 @@
"ssh-config": "^4.4.4",
"tmp": "^0.2.7",
"vscode-cpptools": "^7.1.1",
"vscode-languageclient": "^9.0.1",
"vscode-languageclient": "^10.1.0",
"vscode-nls": "^5.2.0",
"vscode-tas-client": "^0.1.84",
"which": "^2.0.2"
Expand Down
4 changes: 2 additions & 2 deletions Extension/src/Debugger/configurationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* ------------------------------------------------------------------------------------------ */

import * as jsonc from 'comment-json';
import * as glob from 'glob';
import { glob, IOptions } from 'glob';
import * as os from 'os';
import * as path from 'path';
import { promisify } from 'util';
Expand Down Expand Up @@ -40,7 +40,7 @@ enum StepType {
command = 'command'
}

const globAsync: (pattern: string, options?: glob.IOptions | undefined) => Promise<string[]> = promisify(glob);
const globAsync: (pattern: string, options?: IOptions | undefined) => Promise<string[]> = promisify(glob);

/*
* Retrieves configurations from a provider and displays them in a quickpick menu to be selected.
Expand Down
12 changes: 6 additions & 6 deletions Extension/src/LanguageServer/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import * as fs from 'fs';
import * as os from 'os';
import { SourceFileConfiguration, SourceFileConfigurationItem, Version, WorkspaceBrowseConfiguration } from 'vscode-cpptools';
import { IntelliSenseStatus, Status } from 'vscode-cpptools/out/testApi';
import { CloseAction, DidOpenTextDocumentParams, ErrorAction, LanguageClientOptions, NotificationType, Position, Range, RequestType, ResponseError, TextDocumentIdentifier, TextDocumentPositionParams } from 'vscode-languageclient';
import { CloseAction, DidOpenTextDocumentParams, ErrorAction, LanguageClientOptions, NotificationType, Position, Range, RequestType, RequestType0, ResponseError, TextDocumentIdentifier, TextDocumentPositionParams } from 'vscode-languageclient';
import { LanguageClient, ServerOptions } from 'vscode-languageclient/node';
import * as nls from 'vscode-nls';
import { DebugConfigurationProvider } from '../Debugger/configurationProvider';
Expand Down Expand Up @@ -608,11 +608,11 @@ export interface SetOpenFileOriginalEncodingParams {
}

// Requests
const PreInitializationRequest: RequestType<void, string, void> = new RequestType<void, string, void>('cpptools/preinitialize');
const PreInitializationRequest: RequestType0<string, void> = new RequestType0<string, void>('cpptools/preinitialize');
const InitializationRequest: RequestType<CppInitializationParams, CppInitializationResult, void> = new RequestType<CppInitializationParams, CppInitializationResult, void>('cpptools/initialize');
const QueryCompilerDefaultsRequest: RequestType<QueryDefaultCompilerParams, configs.CompilerDefaults, void> = new RequestType<QueryDefaultCompilerParams, configs.CompilerDefaults, void>('cpptools/queryCompilerDefaults');
const SwitchHeaderSourceRequest: RequestType<SwitchHeaderSourceParams, string, void> = new RequestType<SwitchHeaderSourceParams, string, void>('cpptools/didSwitchHeaderSource');
const GetDiagnosticsRequest: RequestType<void, GetDiagnosticsResult, void> = new RequestType<void, GetDiagnosticsResult, void>('cpptools/getDiagnostics');
const GetDiagnosticsRequest: RequestType0<GetDiagnosticsResult, void> = new RequestType0<GetDiagnosticsResult, void>('cpptools/getDiagnostics');
export const GetDocumentSymbolRequest: RequestType<GetDocumentSymbolRequestParams, GetDocumentSymbolResult, void> = new RequestType<GetDocumentSymbolRequestParams, GetDocumentSymbolResult, void>('cpptools/getDocumentSymbols');
export const GetSymbolInfoRequest: RequestType<WorkspaceSymbolParams, LocalizeSymbolInformation[], void> = new RequestType<WorkspaceSymbolParams, LocalizeSymbolInformation[], void>('cpptools/getWorkspaceSymbols');
export const GetFoldingRangesRequest: RequestType<GetFoldingRangesParams, GetFoldingRangesResult, void> = new RequestType<GetFoldingRangesParams, GetFoldingRangesResult, void>('cpptools/getFoldingRanges');
Expand Down Expand Up @@ -1836,12 +1836,12 @@ export class DefaultClient implements Client {
await languageClient.start();

if (usesCrashHandler()) {
watchForCrashes(await languageClient.sendRequest(PreInitializationRequest, null));
watchForCrashes(await languageClient.sendRequest(PreInitializationRequest));
} else if (os.platform() === "win32") {
const settings: CppSettings = new CppSettings();
if ((settings.windowsErrorReportingMode === "default" && !languageClientHasCrashed) ||
settings.windowsErrorReportingMode === "enabled") {
await languageClient.sendRequest(PreInitializationRequest, null);
await languageClient.sendRequest(PreInitializationRequest);
}
}

Expand Down Expand Up @@ -2202,7 +2202,7 @@ export class DefaultClient implements Client {

public async logDiagnostics(): Promise<void> {
await this.ready;
const response: GetDiagnosticsResult = await this.languageClient.sendRequest(GetDiagnosticsRequest, null);
const response: GetDiagnosticsResult = await this.languageClient.sendRequest(GetDiagnosticsRequest);
const diagnosticsChannel: vscode.OutputChannel = getDiagnosticsChannel();
diagnosticsChannel.clear();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import { ContextResolver, ResolveRequest, SupportedContextItem, type ContextProvider } from '@github/copilot-language-server';
import { randomUUID } from 'crypto';
import * as vscode from 'vscode';
import { DocumentSelector } from 'vscode-languageserver-protocol';
import { isBoolean, isNumber, isString } from '../common';
import { getOutputChannelLogger, Logger } from '../logger';
import * as telemetry from '../telemetry';
Expand Down Expand Up @@ -74,7 +73,7 @@ type CacheEntry = [string, CopilotCompletionContextResult];
export class CopilotCompletionContextProvider implements ContextResolver<SupportedContextItem> {
private static readonly providerId = 'ms-vscode.cpptools';
private readonly completionContextCache: Map<string, CacheEntry> = new Map();
private static readonly defaultCppDocumentSelector: DocumentSelector = [{ language: 'cpp' }, { language: 'c' }, { language: 'cuda-cpp' }];
private static readonly defaultCppDocumentSelector: string[] = ['cpp', 'c', 'cuda-cpp'];
// The default time budget for providing a value from resolve().
private static readonly defaultTimeBudgetMs: number = 7;
// Assume the cache is stale when the distance to the current caret is greater than this value.
Expand Down
8 changes: 4 additions & 4 deletions Extension/src/SSH/sshHosts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
* ------------------------------------------------------------------------------------------ */

import { promises as fs } from 'fs';
import * as glob from 'glob';
import { glob, IOptions } from 'glob';
import * as os from 'os';
import * as path from 'path';
import {
Configuration, ConfigurationDirective,
ConfigurationEntry,
Type as ConfigurationEntryType,
HostConfigurationDirective,
ResolvedConfiguration,
parse
parse,
ResolvedConfiguration
} from 'ssh-config';
import { promisify } from 'util';
import * as vscode from 'vscode';
Expand All @@ -25,7 +25,7 @@ import { getSshChannel } from '../logger';
nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
const localize: nls.LocalizeFunc = nls.loadMessageBundle();

const globAsync: (pattern: string, options?: glob.IOptions | undefined) => Promise<string[]> = promisify(glob);
const globAsync: (pattern: string, options?: IOptions | undefined) => Promise<string[]> = promisify(glob);

const userSshConfigurationFile: string = path.resolve(os.homedir(), '.ssh/config');

Expand Down
4 changes: 2 additions & 2 deletions Extension/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import * as os from 'os';
import * as path from 'path';
import * as tmp from 'tmp';
import * as vscode from 'vscode';
import { DocumentFilter, Range } from 'vscode-languageclient';
import { Range } from 'vscode-languageclient';
import * as nls from 'vscode-nls';
import { TargetPopulation } from 'vscode-tas-client';
import { ManualPromise } from './Utility/Async/manualPromise';
Expand Down Expand Up @@ -1538,7 +1538,7 @@ export function whichAsync(name: string, path?: string): Promise<string | undefi
});
}

export const documentSelector: DocumentFilter[] = [
export const documentSelector: vscode.DocumentFilter[] = [
{ scheme: 'file', language: 'c' },
{ scheme: 'file', language: 'cpp' },
{ scheme: 'file', language: 'cuda-cpp' }
Expand Down
5 changes: 3 additions & 2 deletions Extension/test.tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"module": "node16",
"moduleResolution": "node16",
"target": "ES2022",
"outDir": "dist",
"lib": [
Expand All @@ -26,4 +27,4 @@
"node_modules/@types/eslint-scope/node_modules/@types/eslint/index.d.ts",
"node_modules/**"
]
}
}
2 changes: 1 addition & 1 deletion Extension/test/common/selectTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

import { readdir, readFile } from 'fs/promises';
import { glob as globSync, IOptions } from 'glob';
import * as Mocha from 'mocha';
import { basename, dirname, resolve } from 'path';
import { env } from 'process';
import { promisify } from 'util';
import { returns } from '../../src/Utility/Async/returns';
import { filepath } from '../../src/Utility/Filesystem/filepath';
import Mocha = require('mocha');

export const glob: (pattern: string, options?: IOptions | undefined) => Promise<string[]> = promisify(globSync);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,36 @@ function assertEnvironmentEqual(env: Environment[], name: string, value: string)
let found: boolean = false;
for (const e of env) {
if (e.name === name) {
assert(e.value === value, `Checking if ${e.value} == ${value}`);
assert.ok(e.value === value, `Checking if ${e.value} == ${value}`);
found = true;
break;
}
}
assert(found, `${name} was not found in env.`);
assert.ok(found, `${name} was not found in env.`);
}

suite("ParsedEnvironmentFile", () => {
test("Add single variable", () => {
const content: string = `MyName=VALUE`;
const result: ParsedEnvironmentFile = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", []);

assert(!result.Warning, `Failed to assert that Warning was empty: ${result.Warning}`);
assert.ok(!result.Warning, `Failed to assert that Warning was empty: ${result.Warning}`);
assertEnvironmentEqual(result.Env, "MyName", "VALUE");
});

test("Handle quoted values", () => {
const content: string = `MyName="VALUE"`;
const result: ParsedEnvironmentFile = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", []);

assert(!result.Warning, `Failed to assert that Warning was empty: ${result.Warning}`);
assert.ok(!result.Warning, `Failed to assert that Warning was empty: ${result.Warning}`);
assertEnvironmentEqual(result.Env, "MyName", "VALUE");
});

test("Handle BOM", () => {
const content: string = "\uFEFFMyName=VALUE";
const result: ParsedEnvironmentFile = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", []);

assert(!result.Warning, `Failed to assert that Warning was empty: ${result.Warning}`);
assert.ok(!result.Warning, `Failed to assert that Warning was empty: ${result.Warning}`);
assertEnvironmentEqual(result.Env, "MyName", "VALUE");
});

Expand All @@ -51,7 +51,7 @@ MyName2=Value2
`;
const result: ParsedEnvironmentFile = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", []);

assert(!result.Warning, `Failed to assert that Warning was empty: ${result.Warning}`);
assert.ok(!result.Warning, `Failed to assert that Warning was empty: ${result.Warning}`);
assertEnvironmentEqual(result.Env, "MyName1", "Value1");
assertEnvironmentEqual(result.Env, "MyName2", "Value2");
});
Expand All @@ -68,7 +68,7 @@ MyName2=Value2

const result: ParsedEnvironmentFile = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", initialEnv);

assert(!result.Warning, `Failed to assert that Warning was empty: ${result.Warning}`);
assert.ok(!result.Warning, `Failed to assert that Warning was empty: ${result.Warning}`);
assertEnvironmentEqual(result.Env, "MyName1", "Value1");
assertEnvironmentEqual(result.Env, "ThisShouldNotChange", "StillHere");
assertEnvironmentEqual(result.Env, "MyName2", "Value2");
Expand All @@ -82,7 +82,7 @@ MyName2=Value2
`;
const result: ParsedEnvironmentFile = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", []);

assert(!result.Warning, `Failed to assert that Warning was empty: ${result.Warning}`);
assert.ok(!result.Warning, `Failed to assert that Warning was empty: ${result.Warning}`);
assertEnvironmentEqual(result.Env, "MyName1", "Value1");
assertEnvironmentEqual(result.Env, "MyName2", "Value2");
});
Expand All @@ -96,7 +96,7 @@ MyName2=Value2
`;
const result: ParsedEnvironmentFile = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", []);

assert(result.Warning && result.Warning.startsWith("Ignoring non-parsable lines in envFile TestEnvFileName"), 'Checking if warning exists');
assert.ok(result.Warning && result.Warning.startsWith("Ignoring non-parsable lines in envFile TestEnvFileName"), 'Checking if warning exists');
assertEnvironmentEqual(result.Env, "MyName1", "Value1");
assertEnvironmentEqual(result.Env, "MyName2", "Value2");
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import { ContextProviderApiV1 } from '@github/copilot-language-server';
import { ok } from 'assert';
import { afterEach, beforeEach, describe, it } from 'mocha';
import * as proxyquire from 'proxyquire';
import * as sinon from 'sinon';
import * as vscode from 'vscode';
import * as util from '../../../../src/common';
Expand All @@ -17,6 +16,7 @@ import * as extension from '../../../../src/LanguageServer/extension';
import * as lmTool from '../../../../src/LanguageServer/lmTool';
import { ProjectContext } from '../../../../src/LanguageServer/lmTool';
import * as telemetry from '../../../../src/telemetry';
import proxyquire = require('proxyquire');

describe('copilotProviders Tests', () => {
let moduleUnderTest: any;
Expand Down
3 changes: 2 additions & 1 deletion Extension/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"module": "node16",
"moduleResolution": "node16",
"target": "ES2022",
"outDir": "dist",
"lib": [
Expand Down
5 changes: 3 additions & 2 deletions Extension/ui.tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"module": "node16",
"moduleResolution": "node16",
"target": "ES2022",
"outDir": "dist",
"lib": [
Expand All @@ -24,4 +25,4 @@
"node_modules/@types/eslint-scope/node_modules/@types/eslint/index.d.ts",
"node_modules/**"
]
}
}
3 changes: 1 addition & 2 deletions Extension/ui/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,5 +411,4 @@ class SettingsApp {
}
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const app: SettingsApp = new SettingsApp();
void new SettingsApp();
Loading
Loading