Skip to content

Commit f98585b

Browse files
committed
Merge branch 'master' of https://github.com/microsoft/vscode into clantz/devcontainer-use-image
2 parents 6f4a9df + ade8144 commit f98585b

88 files changed

Lines changed: 841 additions & 553 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.nvmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

build/.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
* text eol=lf
2+
*.exe binary
3+
*.dll binary

extensions/css-language-features/server/src/cssServer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
6767
}
6868
}
6969

70-
requestService = getRequestService(params.initializationOptions.handledSchemas || ['file'], connection, runtime);
70+
requestService = getRequestService(params.initializationOptions?.handledSchemas || ['file'], connection, runtime);
7171

7272
function getClientCapability<T>(name: string, def: T) {
7373
const keys = name.split('.');

extensions/debug-auto-launch/src/extension.ts

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6+
import { promises as fs } from 'fs';
67
import { createServer, Server } from 'net';
78
import * as vscode from 'vscode';
89
import * as nls from 'vscode-nls';
@@ -203,7 +204,27 @@ async function createAttachServer(context: vscode.ExtensionContext) {
203204
return undefined;
204205
}
205206

206-
server = new Promise<Server>((resolve, reject) => {
207+
server = createServerInner(ipcAddress).catch(err => {
208+
console.error(err);
209+
return undefined;
210+
});
211+
212+
return await server;
213+
}
214+
215+
const createServerInner = async (ipcAddress: string) => {
216+
try {
217+
return await createServerInstance(ipcAddress);
218+
} catch (e) {
219+
// On unix/linux, the file can 'leak' if the process exits unexpectedly.
220+
// If we see this, try to delete the file and then listen again.
221+
await fs.unlink(ipcAddress).catch(() => undefined);
222+
return await createServerInstance(ipcAddress);
223+
}
224+
};
225+
226+
const createServerInstance = (ipcAddress: string) =>
227+
new Promise<Server>((resolve, reject) => {
207228
const s = createServer(socket => {
208229
let data: Buffer[] = [];
209230
socket.on('data', async chunk => {
@@ -229,14 +250,8 @@ async function createAttachServer(context: vscode.ExtensionContext) {
229250
})
230251
.on('error', reject)
231252
.listen(ipcAddress, () => resolve(s));
232-
}).catch(err => {
233-
console.error(err);
234-
return undefined;
235253
});
236254

237-
return await server;
238-
}
239-
240255
/**
241256
* Destroys the auto-attach server, if it's running.
242257
*/

extensions/html-language-features/server/src/htmlServer.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,16 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
112112
}
113113
}
114114

115-
requestService = getRequestService(params.initializationOptions.handledSchemas || ['file'], connection, runtime);
115+
requestService = getRequestService(initializationOptions?.handledSchemas || ['file'], connection, runtime);
116116

117117
const workspace = {
118118
get settings() { return globalSettings; },
119119
get folders() { return workspaceFolders; }
120120
};
121121

122-
languageModes = getLanguageModes(initializationOptions ? initializationOptions.embeddedLanguages : { css: true, javascript: true }, workspace, params.capabilities, requestService);
122+
languageModes = getLanguageModes(initializationOptions?.embeddedLanguages || { css: true, javascript: true }, workspace, params.capabilities, requestService);
123123

124-
const dataPaths: string[] = params.initializationOptions.dataPaths || [];
124+
const dataPaths: string[] = initializationOptions?.dataPaths || [];
125125
fetchHTMLDataProviders(dataPaths, requestService).then(dataProviders => {
126126
languageModes.updateDataProviders(dataProviders);
127127
});
@@ -146,7 +146,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
146146
}
147147

148148
clientSnippetSupport = getClientCapability('textDocument.completion.completionItem.snippetSupport', false);
149-
dynamicFormatterRegistration = getClientCapability('textDocument.rangeFormatting.dynamicRegistration', false) && (typeof params.initializationOptions.provideFormatter !== 'boolean');
149+
dynamicFormatterRegistration = getClientCapability('textDocument.rangeFormatting.dynamicRegistration', false) && (typeof initializationOptions?.provideFormatter !== 'boolean');
150150
scopedSettingsSupport = getClientCapability('workspace.configuration', false);
151151
workspaceFoldersSupport = getClientCapability('workspace.workspaceFolders', false);
152152
foldingRangeLimit = getClientCapability('textDocument.foldingRange.rangeLimit', Number.MAX_VALUE);
@@ -155,7 +155,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
155155
completionProvider: clientSnippetSupport ? { resolveProvider: true, triggerCharacters: ['.', ':', '<', '"', '=', '/'] } : undefined,
156156
hoverProvider: true,
157157
documentHighlightProvider: true,
158-
documentRangeFormattingProvider: params.initializationOptions.provideFormatter === true,
158+
documentRangeFormattingProvider: initializationOptions?.provideFormatter === true,
159159
documentLinkProvider: { resolveProvider: false },
160160
documentSymbolProvider: true,
161161
definitionProvider: true,

extensions/json-language-features/server/src/jsonServer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
137137
} : undefined,
138138
hoverProvider: true,
139139
documentSymbolProvider: true,
140-
documentRangeFormattingProvider: params.initializationOptions.provideFormatter === true,
140+
documentRangeFormattingProvider: params.initializationOptions?.provideFormatter === true,
141141
colorProvider: {},
142142
foldingRangeProvider: true,
143143
selectionRangeProvider: true,

extensions/typescript-language-features/src/tsServer/serverProcess.browser.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ export class WorkerServerProcess implements TsServerProcess {
1919
_configuration: TypeScriptServiceConfiguration,
2020
) {
2121
const worker = new Worker(tsServerPath);
22-
return new WorkerServerProcess(worker, args);
22+
return new WorkerServerProcess(worker, [
23+
...args,
24+
25+
// Explicitly give TS Server its path so it can
26+
// load local resources
27+
'--executingFilePath', tsServerPath,
28+
]);
2329
}
2430

2531
private _onDataHandlers = new Set<(data: Proto.Response) => void>();

extensions/typescript-language-features/src/tsServer/spawner.ts

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { ClientCapabilities, ClientCapability, ServerType } from '../typescriptS
1010
import API from '../utils/api';
1111
import { SeparateSyntaxServerConfiguration, TsServerLogLevel, TypeScriptServiceConfiguration } from '../utils/configuration';
1212
import { Logger } from '../utils/logger';
13+
import { isWeb } from '../utils/platform';
1314
import { TypeScriptPluginPathsProvider } from '../utils/pluginPathsProvider';
1415
import { PluginManager } from '../utils/plugins';
1516
import { TelemetryReporter } from '../utils/telemetry';
@@ -203,29 +204,35 @@ export class TypeScriptServerSpawner {
203204
}
204205

205206
if (TypeScriptServerSpawner.isLoggingEnabled(configuration)) {
206-
const logDir = this._logDirectoryProvider.getNewLogDirectory();
207-
if (logDir) {
208-
tsServerLogFile = path.join(logDir, `tsserver.log`);
207+
if (isWeb()) {
209208
args.push('--logVerbosity', TsServerLogLevel.toString(configuration.tsServerLogLevel));
210-
args.push('--logFile', tsServerLogFile);
209+
} else {
210+
const logDir = this._logDirectoryProvider.getNewLogDirectory();
211+
if (logDir) {
212+
tsServerLogFile = path.join(logDir, `tsserver.log`);
213+
args.push('--logVerbosity', TsServerLogLevel.toString(configuration.tsServerLogLevel));
214+
args.push('--logFile', tsServerLogFile);
215+
}
211216
}
212217
}
213218

214-
const pluginPaths = this._pluginPathsProvider.getPluginPaths();
219+
if (!isWeb()) {
220+
const pluginPaths = this._pluginPathsProvider.getPluginPaths();
215221

216-
if (pluginManager.plugins.length) {
217-
args.push('--globalPlugins', pluginManager.plugins.map(x => x.name).join(','));
222+
if (pluginManager.plugins.length) {
223+
args.push('--globalPlugins', pluginManager.plugins.map(x => x.name).join(','));
218224

219-
const isUsingBundledTypeScriptVersion = currentVersion.path === this._versionProvider.defaultVersion.path;
220-
for (const plugin of pluginManager.plugins) {
221-
if (isUsingBundledTypeScriptVersion || plugin.enableForWorkspaceTypeScriptVersions) {
222-
pluginPaths.push(plugin.path);
225+
const isUsingBundledTypeScriptVersion = currentVersion.path === this._versionProvider.defaultVersion.path;
226+
for (const plugin of pluginManager.plugins) {
227+
if (isUsingBundledTypeScriptVersion || plugin.enableForWorkspaceTypeScriptVersions) {
228+
pluginPaths.push(plugin.path);
229+
}
223230
}
224231
}
225-
}
226232

227-
if (pluginPaths.length !== 0) {
228-
args.push('--pluginProbeLocations', pluginPaths.join(','));
233+
if (pluginPaths.length !== 0) {
234+
args.push('--pluginProbeLocations', pluginPaths.join(','));
235+
}
229236
}
230237

231238
if (configuration.npmLocation) {

extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,10 @@ suite('vscode API - workspace', () => {
926926
assert.ok(await vscode.workspace.applyEdit(we));
927927

928928
const document = await vscode.workspace.openTextDocument(newUri);
929-
assert.equal(document.isDirty, true);
929+
// See https://github.com/microsoft/vscode/issues/107739
930+
// RenameOperation currently saves the file before applying the rename
931+
// so that is why the document is not dirty here
932+
assert.equal(document.isDirty, false);
930933

931934
await document.save();
932935
assert.equal(document.isDirty, false);

extensions/vscode-test-resolver/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"extensionKind": [ "ui" ],
1212
"scripts": {
1313
"compile": "node ./node_modules/vscode/bin/compile -watch -p ./",
14-
"vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:vscode-test-resolver ./tsconfig.json"
14+
"vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:vscode-test-resolver"
1515
},
1616
"activationEvents": [
1717
"onResolveRemoteAuthority:test",

0 commit comments

Comments
 (0)