commit
7927075f89
65 changed files with 1140 additions and 627 deletions
|
@ -390,7 +390,7 @@ async function webpackExtensions(taskName, isWatch, webpackConfigLocations) {
|
|||
reject();
|
||||
}
|
||||
else {
|
||||
reporter(stats.toJson());
|
||||
reporter(stats === null || stats === void 0 ? void 0 : stats.toJson());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -401,7 +401,7 @@ async function webpackExtensions(taskName, isWatch, webpackConfigLocations) {
|
|||
reject();
|
||||
}
|
||||
else {
|
||||
reporter(stats.toJson());
|
||||
reporter(stats === null || stats === void 0 ? void 0 : stats.toJson());
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -475,7 +475,7 @@ export async function webpackExtensions(taskName: string, isWatch: boolean, webp
|
|||
if (err) {
|
||||
reject();
|
||||
} else {
|
||||
reporter(stats.toJson());
|
||||
reporter(stats?.toJson());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
@ -484,7 +484,7 @@ export async function webpackExtensions(taskName: string, isWatch: boolean, webp
|
|||
fancyLog.error(err);
|
||||
reject();
|
||||
} else {
|
||||
reporter(stats.toJson());
|
||||
reporter(stats?.toJson());
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -33,7 +33,6 @@ module.exports = {
|
|||
stats: {
|
||||
all: false,
|
||||
modules: true,
|
||||
maxModules: 0,
|
||||
errors: true,
|
||||
warnings: true,
|
||||
// our additional options
|
||||
|
|
|
@ -1,79 +0,0 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
|
||||
function format(message, args) {
|
||||
let result;
|
||||
// if (isPseudo) {
|
||||
// // FF3B and FF3D is the Unicode zenkaku representation for [ and ]
|
||||
// message = '\uFF3B' + message.replace(/[aouei]/g, '$&$&') + '\uFF3D';
|
||||
// }
|
||||
if (args.length === 0) {
|
||||
result = message;
|
||||
}
|
||||
else {
|
||||
result = message.replace(/\{(\d+)\}/g, function (match, rest) {
|
||||
let index = rest[0];
|
||||
let arg = args[index];
|
||||
let replacement = match;
|
||||
if (typeof arg === 'string') {
|
||||
replacement = arg;
|
||||
}
|
||||
else if (typeof arg === 'number' || typeof arg === 'boolean' || arg === void 0 || arg === null) {
|
||||
replacement = String(arg);
|
||||
}
|
||||
return replacement;
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function localize(key, message) {
|
||||
let args = [];
|
||||
for (let _i = 2; _i < arguments.length; _i++) {
|
||||
args[_i - 2] = arguments[_i];
|
||||
}
|
||||
return format(message, args);
|
||||
}
|
||||
|
||||
function loadMessageBundle(file) {
|
||||
return localize;
|
||||
}
|
||||
|
||||
let MessageFormat;
|
||||
(function (MessageFormat) {
|
||||
MessageFormat["file"] = "file";
|
||||
MessageFormat["bundle"] = "bundle";
|
||||
MessageFormat["both"] = "both";
|
||||
})(MessageFormat = exports.MessageFormat || (exports.MessageFormat = {}));
|
||||
let BundleFormat;
|
||||
(function (BundleFormat) {
|
||||
// the nls.bundle format
|
||||
BundleFormat["standalone"] = "standalone";
|
||||
BundleFormat["languagePack"] = "languagePack";
|
||||
})(BundleFormat = exports.BundleFormat || (exports.BundleFormat = {}));
|
||||
|
||||
exports.loadMessageBundle = loadMessageBundle;
|
||||
function config(opts) {
|
||||
if (opts) {
|
||||
if (isString(opts.locale)) {
|
||||
options.locale = opts.locale.toLowerCase();
|
||||
options.language = options.locale;
|
||||
resolvedLanguage = undefined;
|
||||
resolvedBundles = Object.create(null);
|
||||
}
|
||||
if (opts.messageFormat !== undefined) {
|
||||
options.messageFormat = opts.messageFormat;
|
||||
}
|
||||
if (opts.bundleFormat === BundleFormat.standalone && options.languagePackSupport === true) {
|
||||
options.languagePackSupport = false;
|
||||
}
|
||||
}
|
||||
isPseudo = options.locale === 'pseudo';
|
||||
return loadMessageBundle;
|
||||
}
|
||||
exports.config = config;
|
|
@ -21,7 +21,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"jsonc-parser": "^2.2.1",
|
||||
"vscode-nls": "^4.1.1"
|
||||
"vscode-nls": "^5.0.0"
|
||||
},
|
||||
"capabilities": {
|
||||
"virtualWorkspaces": true,
|
||||
|
|
|
@ -12,7 +12,7 @@ jsonc-parser@^2.2.1:
|
|||
resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-2.2.1.tgz#db73cd59d78cce28723199466b2a03d1be1df2bc"
|
||||
integrity sha512-o6/yDBYccGvTz1+QFevz6l6OBZ2+fMVu2JZ9CIhzsYRX4mjaK5IyX9eldUdCmga16zlgQxyrj5pt9kzuj2C02w==
|
||||
|
||||
vscode-nls@^4.1.1:
|
||||
version "4.1.1"
|
||||
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.1.1.tgz#f9916b64e4947b20322defb1e676a495861f133c"
|
||||
integrity sha512-4R+2UoUUU/LdnMnFjePxfLqNhBS8lrAFyX7pjb2ud/lqDkrUavFUTcG7wR0HBZFakae0Q6KLBFjMS6W93F403A==
|
||||
vscode-nls@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.0.tgz#99f0da0bd9ea7cda44e565a74c54b1f2bc257840"
|
||||
integrity sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==
|
||||
|
|
|
@ -18,6 +18,7 @@ module.exports = withBrowserDefaults({
|
|||
output: {
|
||||
filename: 'cssServerMain.js',
|
||||
path: path.join(__dirname, 'dist', 'browser'),
|
||||
libraryTarget: 'var'
|
||||
libraryTarget: 'var',
|
||||
library: 'serverExportVar'
|
||||
}
|
||||
});
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { createConnection, BrowserMessageReader, BrowserMessageWriter } from 'vscode-languageserver/browser';
|
||||
import { startServer } from '../cssServer';
|
||||
import { createConnection, BrowserMessageReader, BrowserMessageWriter, Disposable } from 'vscode-languageserver/browser';
|
||||
import { RuntimeEnvironment, startServer } from '../cssServer';
|
||||
|
||||
declare let self: any;
|
||||
|
||||
|
@ -13,4 +13,17 @@ const messageWriter = new BrowserMessageWriter(self);
|
|||
|
||||
const connection = createConnection(messageReader, messageWriter);
|
||||
|
||||
startServer(connection, {});
|
||||
const runtime: RuntimeEnvironment = {
|
||||
timer: {
|
||||
setImmediate(callback: (...args: any[]) => void, ...args: any[]): Disposable {
|
||||
const handle = setTimeout(callback, 0, ...args);
|
||||
return { dispose: () => clearTimeout(handle) };
|
||||
},
|
||||
setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): Disposable {
|
||||
const handle = setTimeout(callback, ms, ...args);
|
||||
return { dispose: () => clearTimeout(handle) };
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
startServer(connection, runtime);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import {
|
||||
Connection, TextDocuments, InitializeParams, InitializeResult, ServerCapabilities, ConfigurationRequest, WorkspaceFolder, TextDocumentSyncKind, NotificationType
|
||||
Connection, TextDocuments, InitializeParams, InitializeResult, ServerCapabilities, ConfigurationRequest, WorkspaceFolder, TextDocumentSyncKind, NotificationType, Disposable
|
||||
} from 'vscode-languageserver';
|
||||
import { URI } from 'vscode-uri';
|
||||
import { getCSSLanguageService, getSCSSLanguageService, getLESSLanguageService, LanguageSettings, LanguageService, Stylesheet, TextDocument, Position } from 'vscode-css-languageservice';
|
||||
|
@ -25,8 +25,12 @@ export interface Settings {
|
|||
}
|
||||
|
||||
export interface RuntimeEnvironment {
|
||||
file?: RequestService;
|
||||
http?: RequestService
|
||||
readonly file?: RequestService;
|
||||
readonly http?: RequestService;
|
||||
readonly timer: {
|
||||
setImmediate(callback: (...args: any[]) => void, ...args: any[]): Disposable;
|
||||
setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): Disposable;
|
||||
}
|
||||
}
|
||||
|
||||
export function startServer(connection: Connection, runtime: RuntimeEnvironment) {
|
||||
|
@ -150,7 +154,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
documents.all().forEach(triggerValidation);
|
||||
}
|
||||
|
||||
const pendingValidationRequests: { [uri: string]: NodeJS.Timer } = {};
|
||||
const pendingValidationRequests: { [uri: string]: Disposable } = {};
|
||||
const validationDelayMs = 500;
|
||||
|
||||
// The content of a text document has changed. This event is emitted
|
||||
|
@ -168,14 +172,14 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
function cleanPendingValidation(textDocument: TextDocument): void {
|
||||
const request = pendingValidationRequests[textDocument.uri];
|
||||
if (request) {
|
||||
clearTimeout(request);
|
||||
request.dispose();
|
||||
delete pendingValidationRequests[textDocument.uri];
|
||||
}
|
||||
}
|
||||
|
||||
function triggerValidation(textDocument: TextDocument): void {
|
||||
cleanPendingValidation(textDocument);
|
||||
pendingValidationRequests[textDocument.uri] = setTimeout(() => {
|
||||
pendingValidationRequests[textDocument.uri] = runtime.timer.setTimeout(() => {
|
||||
delete pendingValidationRequests[textDocument.uri];
|
||||
validateTextDocument(textDocument);
|
||||
}, validationDelayMs);
|
||||
|
@ -203,7 +207,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
}
|
||||
|
||||
connection.onCompletion((textDocumentPosition, token) => {
|
||||
return runSafeAsync(async () => {
|
||||
return runSafeAsync(runtime, async () => {
|
||||
const document = documents.get(textDocumentPosition.textDocument.uri);
|
||||
if (document) {
|
||||
const [settings,] = await Promise.all([getDocumentSettings(document), dataProvidersReady]);
|
||||
|
@ -216,7 +220,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.onHover((textDocumentPosition, token) => {
|
||||
return runSafeAsync(async () => {
|
||||
return runSafeAsync(runtime, async () => {
|
||||
const document = documents.get(textDocumentPosition.textDocument.uri);
|
||||
if (document) {
|
||||
const [settings,] = await Promise.all([getDocumentSettings(document), dataProvidersReady]);
|
||||
|
@ -228,7 +232,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.onDocumentSymbol((documentSymbolParams, token) => {
|
||||
return runSafeAsync(async () => {
|
||||
return runSafeAsync(runtime, async () => {
|
||||
const document = documents.get(documentSymbolParams.textDocument.uri);
|
||||
if (document) {
|
||||
await dataProvidersReady;
|
||||
|
@ -240,7 +244,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.onDefinition((documentDefinitionParams, token) => {
|
||||
return runSafeAsync(async () => {
|
||||
return runSafeAsync(runtime, async () => {
|
||||
const document = documents.get(documentDefinitionParams.textDocument.uri);
|
||||
if (document) {
|
||||
await dataProvidersReady;
|
||||
|
@ -252,7 +256,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.onDocumentHighlight((documentHighlightParams, token) => {
|
||||
return runSafeAsync(async () => {
|
||||
return runSafeAsync(runtime, async () => {
|
||||
const document = documents.get(documentHighlightParams.textDocument.uri);
|
||||
if (document) {
|
||||
await dataProvidersReady;
|
||||
|
@ -265,7 +269,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
|
||||
|
||||
connection.onDocumentLinks(async (documentLinkParams, token) => {
|
||||
return runSafeAsync(async () => {
|
||||
return runSafeAsync(runtime, async () => {
|
||||
const document = documents.get(documentLinkParams.textDocument.uri);
|
||||
if (document) {
|
||||
await dataProvidersReady;
|
||||
|
@ -279,7 +283,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
|
||||
|
||||
connection.onReferences((referenceParams, token) => {
|
||||
return runSafeAsync(async () => {
|
||||
return runSafeAsync(runtime, async () => {
|
||||
const document = documents.get(referenceParams.textDocument.uri);
|
||||
if (document) {
|
||||
await dataProvidersReady;
|
||||
|
@ -291,7 +295,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.onCodeAction((codeActionParams, token) => {
|
||||
return runSafeAsync(async () => {
|
||||
return runSafeAsync(runtime, async () => {
|
||||
const document = documents.get(codeActionParams.textDocument.uri);
|
||||
if (document) {
|
||||
await dataProvidersReady;
|
||||
|
@ -303,7 +307,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.onDocumentColor((params, token) => {
|
||||
return runSafeAsync(async () => {
|
||||
return runSafeAsync(runtime, async () => {
|
||||
const document = documents.get(params.textDocument.uri);
|
||||
if (document) {
|
||||
await dataProvidersReady;
|
||||
|
@ -315,7 +319,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.onColorPresentation((params, token) => {
|
||||
return runSafeAsync(async () => {
|
||||
return runSafeAsync(runtime, async () => {
|
||||
const document = documents.get(params.textDocument.uri);
|
||||
if (document) {
|
||||
await dataProvidersReady;
|
||||
|
@ -327,7 +331,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.onRenameRequest((renameParameters, token) => {
|
||||
return runSafeAsync(async () => {
|
||||
return runSafeAsync(runtime, async () => {
|
||||
const document = documents.get(renameParameters.textDocument.uri);
|
||||
if (document) {
|
||||
await dataProvidersReady;
|
||||
|
@ -339,7 +343,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.onFoldingRanges((params, token) => {
|
||||
return runSafeAsync(async () => {
|
||||
return runSafeAsync(runtime, async () => {
|
||||
const document = documents.get(params.textDocument.uri);
|
||||
if (document) {
|
||||
await dataProvidersReady;
|
||||
|
@ -350,7 +354,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.onSelectionRanges((params, token) => {
|
||||
return runSafeAsync(async () => {
|
||||
return runSafeAsync(runtime, async () => {
|
||||
const document = documents.get(params.textDocument.uri);
|
||||
const positions: Position[] = params.positions;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { TextDocument } from 'vscode-languageserver';
|
||||
import { TextDocument } from 'vscode-css-languageservice';
|
||||
|
||||
export interface LanguageModelCache<T> {
|
||||
get(document: TextDocument): T;
|
||||
|
@ -79,4 +79,4 @@ export function getLanguageModelCache<T>(maxEntries: number, cleanupIntervalTime
|
|||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { createConnection, Connection } from 'vscode-languageserver/node';
|
||||
import { createConnection, Connection, Disposable } from 'vscode-languageserver/node';
|
||||
import { formatError } from '../utils/runner';
|
||||
import { startServer } from '../cssServer';
|
||||
import { RuntimeEnvironment, startServer } from '../cssServer';
|
||||
import { getNodeFSRequestService } from './nodeFs';
|
||||
|
||||
// Create a connection for the server.
|
||||
|
@ -18,4 +18,18 @@ process.on('unhandledRejection', (e: any) => {
|
|||
connection.console.error(formatError(`Unhandled exception`, e));
|
||||
});
|
||||
|
||||
startServer(connection, { file: getNodeFSRequestService() });
|
||||
const runtime: RuntimeEnvironment = {
|
||||
timer: {
|
||||
setImmediate(callback: (...args: any[]) => void, ...args: any[]): Disposable {
|
||||
const handle = setImmediate(callback, ...args);
|
||||
return { dispose: () => clearImmediate(handle) };
|
||||
},
|
||||
setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): Disposable {
|
||||
const handle = setTimeout(callback, ms, ...args);
|
||||
return { dispose: () => clearTimeout(handle) };
|
||||
}
|
||||
},
|
||||
file: getNodeFSRequestService()
|
||||
};
|
||||
|
||||
startServer(connection, runtime);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ResponseError, CancellationToken, LSPErrorCodes } from 'vscode-languageserver';
|
||||
import { RuntimeEnvironment } from '../cssServer';
|
||||
|
||||
export function formatError(message: string, err: any): string {
|
||||
if (err instanceof Error) {
|
||||
|
@ -17,9 +18,9 @@ export function formatError(message: string, err: any): string {
|
|||
return message;
|
||||
}
|
||||
|
||||
export function runSafeAsync<T>(func: () => Thenable<T>, errorVal: T, errorMessage: string, token: CancellationToken): Thenable<T | ResponseError<any>> {
|
||||
export function runSafeAsync<T>(runtime: RuntimeEnvironment, func: () => Thenable<T>, errorVal: T, errorMessage: string, token: CancellationToken): Thenable<T | ResponseError<any>> {
|
||||
return new Promise<T | ResponseError<any>>((resolve) => {
|
||||
setImmediate(() => {
|
||||
runtime.timer.setImmediate(() => {
|
||||
if (token.isCancellationRequested) {
|
||||
resolve(cancelValue());
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
"jsonc-parser": "^2.2.1",
|
||||
"markdown-it": "^12.0.4",
|
||||
"parse5": "^3.0.2",
|
||||
"vscode-nls": "^4.1.1"
|
||||
"vscode-nls": "^5.0.0"
|
||||
},
|
||||
"contributes": {
|
||||
"jsonValidation": [
|
||||
|
|
|
@ -18,4 +18,5 @@ function registerPackageDocumentCompletions(): vscode.Disposable {
|
|||
return new PackageDocument(document).provideCompletionItems(position, token);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ uc.micro@^1.0.5:
|
|||
resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.6.tgz#9c411a802a409a91fc6cf74081baba34b24499ac"
|
||||
integrity sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==
|
||||
|
||||
vscode-nls@^4.1.1:
|
||||
version "4.1.1"
|
||||
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.1.1.tgz#f9916b64e4947b20322defb1e676a495861f133c"
|
||||
integrity sha512-4R+2UoUUU/LdnMnFjePxfLqNhBS8lrAFyX7pjb2ud/lqDkrUavFUTcG7wR0HBZFakae0Q6KLBFjMS6W93F403A==
|
||||
vscode-nls@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.0.tgz#99f0da0bd9ea7cda44e565a74c54b1f2bc257840"
|
||||
integrity sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
"node-fetch": "2.6.1",
|
||||
"uuid": "8.1.0",
|
||||
"vscode-extension-telemetry": "0.1.7",
|
||||
"vscode-nls": "^4.1.2",
|
||||
"vscode-nls": "^5.0.0",
|
||||
"vscode-tas-client": "^0.1.22"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -175,10 +175,10 @@ vscode-extension-telemetry@0.1.7:
|
|||
dependencies:
|
||||
applicationinsights "1.7.4"
|
||||
|
||||
vscode-nls@^4.1.2:
|
||||
version "4.1.2"
|
||||
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.1.2.tgz#ca8bf8bb82a0987b32801f9fddfdd2fb9fd3c167"
|
||||
integrity sha512-7bOHxPsfyuCqmP+hZXscLhiHwe7CSuFE4hyhbs22xPIhQ4jv99FcR4eBzfYYVLP356HNFpdvz63FFb/xw6T4Iw==
|
||||
vscode-nls@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.0.tgz#99f0da0bd9ea7cda44e565a74c54b1f2bc257840"
|
||||
integrity sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==
|
||||
|
||||
vscode-tas-client@^0.1.22:
|
||||
version "0.1.22"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ExtensionContext, Uri } from 'vscode';
|
||||
import { Disposable, ExtensionContext, Uri } from 'vscode';
|
||||
import { LanguageClientOptions } from 'vscode-languageclient';
|
||||
import { startClient, LanguageClientConstructor } from '../htmlClient';
|
||||
import { LanguageClient } from 'vscode-languageclient/browser';
|
||||
|
@ -24,7 +24,14 @@ export function activate(context: ExtensionContext) {
|
|||
return new LanguageClient(id, name, clientOptions, worker);
|
||||
};
|
||||
|
||||
startClient(context, newLanguageClient, { TextDecoder });
|
||||
const timer = {
|
||||
setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): Disposable {
|
||||
const handle = setTimeout(callback, ms, ...args);
|
||||
return { dispose: () => clearTimeout(handle) };
|
||||
}
|
||||
};
|
||||
|
||||
startClient(context, newLanguageClient, { TextDecoder, timer });
|
||||
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
|
|
|
@ -58,6 +58,9 @@ export interface Runtime {
|
|||
TextDecoder: { new(encoding?: string): { decode(buffer: ArrayBuffer): string; } };
|
||||
fs?: RequestService;
|
||||
telemetry?: TelemetryReporter;
|
||||
readonly timer: {
|
||||
setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): Disposable;
|
||||
}
|
||||
}
|
||||
|
||||
export function startClient(context: ExtensionContext, newLanguageClient: LanguageClientConstructor, runtime: Runtime) {
|
||||
|
@ -126,7 +129,7 @@ export function startClient(context: ExtensionContext, newLanguageClient: Langua
|
|||
let param = client.code2ProtocolConverter.asTextDocumentPositionParams(document, position);
|
||||
return client.sendRequest(TagCloseRequest.type, param);
|
||||
};
|
||||
disposable = activateTagClosing(tagRequestor, { html: true, handlebars: true }, 'html.autoClosingTags');
|
||||
disposable = activateTagClosing(tagRequestor, { html: true, handlebars: true }, 'html.autoClosingTags', runtime);
|
||||
toDispose.push(disposable);
|
||||
|
||||
disposable = client.onTelemetry(e => {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { getNodeFSRequestService } from './nodeFs';
|
||||
import { ExtensionContext } from 'vscode';
|
||||
import { Disposable, ExtensionContext } from 'vscode';
|
||||
import { startClient, LanguageClientConstructor } from '../htmlClient';
|
||||
import { ServerOptions, TransportKind, LanguageClientOptions, LanguageClient } from 'vscode-languageclient/node';
|
||||
import { TextDecoder } from 'util';
|
||||
|
@ -37,7 +37,14 @@ export function activate(context: ExtensionContext) {
|
|||
return new LanguageClient(id, name, serverOptions, clientOptions);
|
||||
};
|
||||
|
||||
startClient(context, newLanguageClient, { fs: getNodeFSRequestService(), TextDecoder, telemetry });
|
||||
const timer = {
|
||||
setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): Disposable {
|
||||
const handle = setTimeout(callback, ms, ...args);
|
||||
return { dispose: () => clearTimeout(handle) };
|
||||
}
|
||||
};
|
||||
|
||||
startClient(context, newLanguageClient, { fs: getNodeFSRequestService(), TextDecoder, telemetry, timer });
|
||||
}
|
||||
|
||||
interface IPackageInfo {
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { window, workspace, Disposable, TextDocumentContentChangeEvent, TextDocument, Position, SnippetString } from 'vscode';
|
||||
import { Runtime } from './htmlClient';
|
||||
|
||||
export function activateTagClosing(tagProvider: (document: TextDocument, position: Position) => Thenable<string>, supportedLanguages: { [id: string]: boolean }, configName: string): Disposable {
|
||||
export function activateTagClosing(tagProvider: (document: TextDocument, position: Position) => Thenable<string>, supportedLanguages: { [id: string]: boolean }, configName: string, runtime: Runtime): Disposable {
|
||||
|
||||
let disposables: Disposable[] = [];
|
||||
workspace.onDidChangeTextDocument(event => onDidChangeTextDocument(event.document, event.contentChanges), null, disposables);
|
||||
|
@ -14,7 +15,13 @@ export function activateTagClosing(tagProvider: (document: TextDocument, positio
|
|||
updateEnabledState();
|
||||
window.onDidChangeActiveTextEditor(updateEnabledState, null, disposables);
|
||||
|
||||
let timeout: NodeJS.Timer | undefined = undefined;
|
||||
let timeout: Disposable | undefined = undefined;
|
||||
|
||||
disposables.push({
|
||||
dispose: () => {
|
||||
timeout?.dispose();
|
||||
}
|
||||
});
|
||||
|
||||
function updateEnabledState() {
|
||||
isEnabled = false;
|
||||
|
@ -40,8 +47,8 @@ export function activateTagClosing(tagProvider: (document: TextDocument, positio
|
|||
if (document !== activeDocument || changes.length === 0) {
|
||||
return;
|
||||
}
|
||||
if (typeof timeout !== 'undefined') {
|
||||
clearTimeout(timeout);
|
||||
if (timeout) {
|
||||
timeout.dispose();
|
||||
}
|
||||
let lastChange = changes[changes.length - 1];
|
||||
let lastCharacter = lastChange.text[lastChange.text.length - 1];
|
||||
|
@ -50,7 +57,7 @@ export function activateTagClosing(tagProvider: (document: TextDocument, positio
|
|||
}
|
||||
let rangeStart = lastChange.range.start;
|
||||
let version = document.version;
|
||||
timeout = setTimeout(() => {
|
||||
timeout = runtime.timer.setTimeout(() => {
|
||||
let position = new Position(rangeStart.line, rangeStart.character + lastChange.text.length);
|
||||
tagProvider(document, position).then(text => {
|
||||
if (text && isEnabled) {
|
||||
|
@ -72,4 +79,4 @@ export function activateTagClosing(tagProvider: (document: TextDocument, positio
|
|||
}, 100);
|
||||
}
|
||||
return Disposable.from(...disposables);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,8 @@ const serverConfig = withBrowserDefaults({
|
|||
output: {
|
||||
filename: 'htmlServerMain.js',
|
||||
path: path.join(__dirname, 'dist', 'browser'),
|
||||
libraryTarget: 'var'
|
||||
libraryTarget: 'var',
|
||||
library: 'serverExportVar'
|
||||
},
|
||||
optimization: {
|
||||
splitChunks: {
|
||||
|
@ -26,7 +27,7 @@ const serverConfig = withBrowserDefaults({
|
|||
}
|
||||
}
|
||||
});
|
||||
serverConfig.module.noParse = /typescript[\/\\]lib[\/\\]typescript\.js/;
|
||||
serverConfig.module.noParse = /typescript[\/\\]lib[\/\\]typescript\.js/;
|
||||
serverConfig.module.rules.push({
|
||||
test: /javascriptLibs.ts$/,
|
||||
use: [
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { createConnection, BrowserMessageReader, BrowserMessageWriter } from 'vscode-languageserver/browser';
|
||||
import { startServer } from '../htmlServer';
|
||||
import { createConnection, BrowserMessageReader, BrowserMessageWriter, Disposable } from 'vscode-languageserver/browser';
|
||||
import { RuntimeEnvironment, startServer } from '../htmlServer';
|
||||
|
||||
declare let self: any;
|
||||
|
||||
|
@ -13,4 +13,17 @@ const messageWriter = new BrowserMessageWriter(self);
|
|||
|
||||
const connection = createConnection(messageReader, messageWriter);
|
||||
|
||||
startServer(connection, {});
|
||||
const runtime: RuntimeEnvironment = {
|
||||
timer: {
|
||||
setImmediate(callback: (...args: any[]) => void, ...args: any[]): Disposable {
|
||||
const handle = setTimeout(callback, 0, ...args);
|
||||
return { dispose: () => clearTimeout(handle) };
|
||||
},
|
||||
setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): Disposable {
|
||||
const handle = setTimeout(callback, ms, ...args);
|
||||
return { dispose: () => clearTimeout(handle) };
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
startServer(connection, runtime);
|
||||
|
|
|
@ -50,6 +50,10 @@ export interface RuntimeEnvironment {
|
|||
file?: RequestService;
|
||||
http?: RequestService
|
||||
configureHttpRequests?(proxy: string, strictSSL: boolean): void;
|
||||
readonly timer: {
|
||||
setImmediate(callback: (...args: any[]) => void, ...args: any[]): Disposable;
|
||||
setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): Disposable;
|
||||
}
|
||||
}
|
||||
|
||||
export function startServer(connection: Connection, runtime: RuntimeEnvironment) {
|
||||
|
@ -215,7 +219,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
}
|
||||
});
|
||||
|
||||
const pendingValidationRequests: { [uri: string]: NodeJS.Timer } = {};
|
||||
const pendingValidationRequests: { [uri: string]: Disposable } = {};
|
||||
const validationDelayMs = 500;
|
||||
|
||||
// The content of a text document has changed. This event is emitted
|
||||
|
@ -233,14 +237,14 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
function cleanPendingValidation(textDocument: TextDocument): void {
|
||||
const request = pendingValidationRequests[textDocument.uri];
|
||||
if (request) {
|
||||
clearTimeout(request);
|
||||
request.dispose();
|
||||
delete pendingValidationRequests[textDocument.uri];
|
||||
}
|
||||
}
|
||||
|
||||
function triggerValidation(textDocument: TextDocument): void {
|
||||
cleanPendingValidation(textDocument);
|
||||
pendingValidationRequests[textDocument.uri] = setTimeout(() => {
|
||||
pendingValidationRequests[textDocument.uri] = runtime.timer.setTimeout(() => {
|
||||
delete pendingValidationRequests[textDocument.uri];
|
||||
validateTextDocument(textDocument);
|
||||
}, validationDelayMs);
|
||||
|
@ -277,7 +281,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
}
|
||||
|
||||
connection.onCompletion(async (textDocumentPosition, token) => {
|
||||
return runSafe(async () => {
|
||||
return runSafe(runtime, async () => {
|
||||
const document = documents.get(textDocumentPosition.textDocument.uri);
|
||||
if (!document) {
|
||||
return null;
|
||||
|
@ -305,7 +309,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.onCompletionResolve((item, token) => {
|
||||
return runSafe(async () => {
|
||||
return runSafe(runtime, async () => {
|
||||
const data = item.data;
|
||||
if (data && data.languageId && data.uri) {
|
||||
const mode = languageModes.getMode(data.languageId);
|
||||
|
@ -319,7 +323,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.onHover((textDocumentPosition, token) => {
|
||||
return runSafe(async () => {
|
||||
return runSafe(runtime, async () => {
|
||||
const document = documents.get(textDocumentPosition.textDocument.uri);
|
||||
if (document) {
|
||||
const mode = languageModes.getModeAtPosition(document, textDocumentPosition.position);
|
||||
|
@ -334,7 +338,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.onDocumentHighlight((documentHighlightParams, token) => {
|
||||
return runSafe(async () => {
|
||||
return runSafe(runtime, async () => {
|
||||
const document = documents.get(documentHighlightParams.textDocument.uri);
|
||||
if (document) {
|
||||
const mode = languageModes.getModeAtPosition(document, documentHighlightParams.position);
|
||||
|
@ -347,7 +351,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.onDefinition((definitionParams, token) => {
|
||||
return runSafe(async () => {
|
||||
return runSafe(runtime, async () => {
|
||||
const document = documents.get(definitionParams.textDocument.uri);
|
||||
if (document) {
|
||||
const mode = languageModes.getModeAtPosition(document, definitionParams.position);
|
||||
|
@ -360,7 +364,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.onReferences((referenceParams, token) => {
|
||||
return runSafe(async () => {
|
||||
return runSafe(runtime, async () => {
|
||||
const document = documents.get(referenceParams.textDocument.uri);
|
||||
if (document) {
|
||||
const mode = languageModes.getModeAtPosition(document, referenceParams.position);
|
||||
|
@ -373,7 +377,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.onSignatureHelp((signatureHelpParms, token) => {
|
||||
return runSafe(async () => {
|
||||
return runSafe(runtime, async () => {
|
||||
const document = documents.get(signatureHelpParms.textDocument.uri);
|
||||
if (document) {
|
||||
const mode = languageModes.getModeAtPosition(document, signatureHelpParms.position);
|
||||
|
@ -401,15 +405,15 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
}
|
||||
|
||||
connection.onDocumentRangeFormatting((formatParams, token) => {
|
||||
return runSafe(() => onFormat(formatParams.textDocument, formatParams.range, formatParams.options), [], `Error while formatting range for ${formatParams.textDocument.uri}`, token);
|
||||
return runSafe(runtime, () => onFormat(formatParams.textDocument, formatParams.range, formatParams.options), [], `Error while formatting range for ${formatParams.textDocument.uri}`, token);
|
||||
});
|
||||
|
||||
connection.onDocumentFormatting((formatParams, token) => {
|
||||
return runSafe(() => onFormat(formatParams.textDocument, undefined, formatParams.options), [], `Error while formatting ${formatParams.textDocument.uri}`, token);
|
||||
return runSafe(runtime, () => onFormat(formatParams.textDocument, undefined, formatParams.options), [], `Error while formatting ${formatParams.textDocument.uri}`, token);
|
||||
});
|
||||
|
||||
connection.onDocumentLinks((documentLinkParam, token) => {
|
||||
return runSafe(async () => {
|
||||
return runSafe(runtime, async () => {
|
||||
const document = documents.get(documentLinkParam.textDocument.uri);
|
||||
const links: DocumentLink[] = [];
|
||||
if (document) {
|
||||
|
@ -425,7 +429,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.onDocumentSymbol((documentSymbolParms, token) => {
|
||||
return runSafe(async () => {
|
||||
return runSafe(runtime, async () => {
|
||||
const document = documents.get(documentSymbolParms.textDocument.uri);
|
||||
const symbols: SymbolInformation[] = [];
|
||||
if (document) {
|
||||
|
@ -440,7 +444,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.onRequest(DocumentColorRequest.type, (params, token) => {
|
||||
return runSafe(async () => {
|
||||
return runSafe(runtime, async () => {
|
||||
const infos: ColorInformation[] = [];
|
||||
const document = documents.get(params.textDocument.uri);
|
||||
if (document) {
|
||||
|
@ -455,7 +459,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.onRequest(ColorPresentationRequest.type, (params, token) => {
|
||||
return runSafe(async () => {
|
||||
return runSafe(runtime, async () => {
|
||||
const document = documents.get(params.textDocument.uri);
|
||||
if (document) {
|
||||
const mode = languageModes.getModeAtPosition(document, params.range.start);
|
||||
|
@ -468,7 +472,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.onRequest(TagCloseRequest.type, (params, token) => {
|
||||
return runSafe(async () => {
|
||||
return runSafe(runtime, async () => {
|
||||
const document = documents.get(params.textDocument.uri);
|
||||
if (document) {
|
||||
const pos = params.position;
|
||||
|
@ -484,7 +488,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.onFoldingRanges((params, token) => {
|
||||
return runSafe(async () => {
|
||||
return runSafe(runtime, async () => {
|
||||
const document = documents.get(params.textDocument.uri);
|
||||
if (document) {
|
||||
return getFoldingRanges(languageModes, document, foldingRangeLimit, token);
|
||||
|
@ -494,7 +498,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.onSelectionRanges((params, token) => {
|
||||
return runSafe(async () => {
|
||||
return runSafe(runtime, async () => {
|
||||
const document = documents.get(params.textDocument.uri);
|
||||
if (document) {
|
||||
return getSelectionRanges(languageModes, document, params.positions);
|
||||
|
@ -504,7 +508,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.onRenameRequest((params, token) => {
|
||||
return runSafe(async () => {
|
||||
return runSafe(runtime, async () => {
|
||||
const document = documents.get(params.textDocument.uri);
|
||||
const position: Position = params.position;
|
||||
|
||||
|
@ -520,7 +524,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.languages.onLinkedEditingRange((params, token) => {
|
||||
return <any> /* todo remove when microsoft/vscode-languageserver-node#700 fixed */ runSafe(async () => {
|
||||
return <any> /* todo remove when microsoft/vscode-languageserver-node#700 fixed */ runSafe(runtime, async () => {
|
||||
const document = documents.get(params.textDocument.uri);
|
||||
if (document) {
|
||||
const pos = params.position;
|
||||
|
@ -547,7 +551,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
}
|
||||
|
||||
connection.onRequest(SemanticTokenRequest.type, (params, token) => {
|
||||
return runSafe(async () => {
|
||||
return runSafe(runtime, async () => {
|
||||
const document = documents.get(params.textDocument.uri);
|
||||
if (document) {
|
||||
return getSemanticTokenProvider().getSemanticTokens(document, params.ranges);
|
||||
|
@ -557,7 +561,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.onRequest(SemanticTokenLegendRequest.type, token => {
|
||||
return runSafe(async () => {
|
||||
return runSafe(runtime, async () => {
|
||||
return getSemanticTokenProvider().legend;
|
||||
}, null, `Error while computing semantic tokens legend`, token);
|
||||
});
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { createConnection, Connection } from 'vscode-languageserver/node';
|
||||
import { createConnection, Connection, Disposable } from 'vscode-languageserver/node';
|
||||
import { formatError } from '../utils/runner';
|
||||
import { startServer } from '../htmlServer';
|
||||
import { RuntimeEnvironment, startServer } from '../htmlServer';
|
||||
import { getNodeFSRequestService } from './nodeFs';
|
||||
|
||||
|
||||
|
@ -19,5 +19,18 @@ process.on('unhandledRejection', (e: any) => {
|
|||
connection.console.error(formatError(`Unhandled exception`, e));
|
||||
});
|
||||
|
||||
const runtime: RuntimeEnvironment = {
|
||||
timer: {
|
||||
setImmediate(callback: (...args: any[]) => void, ...args: any[]): Disposable {
|
||||
const handle = setImmediate(callback, ...args);
|
||||
return { dispose: () => clearImmediate(handle) };
|
||||
},
|
||||
setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): Disposable {
|
||||
const handle = setTimeout(callback, ms, ...args);
|
||||
return { dispose: () => clearTimeout(handle) };
|
||||
}
|
||||
},
|
||||
file: getNodeFSRequestService()
|
||||
};
|
||||
|
||||
startServer(connection, { file: getNodeFSRequestService() });
|
||||
startServer(connection, runtime);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ResponseError, CancellationToken, LSPErrorCodes } from 'vscode-languageserver';
|
||||
import { RuntimeEnvironment } from '../htmlServer';
|
||||
|
||||
export function formatError(message: string, err: any): string {
|
||||
if (err instanceof Error) {
|
||||
|
@ -17,9 +18,9 @@ export function formatError(message: string, err: any): string {
|
|||
return message;
|
||||
}
|
||||
|
||||
export function runSafe<T>(func: () => Thenable<T>, errorVal: T, errorMessage: string, token: CancellationToken): Thenable<T | ResponseError<any>> {
|
||||
export function runSafe<T>(runtime: RuntimeEnvironment, func: () => Thenable<T>, errorVal: T, errorMessage: string, token: CancellationToken): Thenable<T | ResponseError<any>> {
|
||||
return new Promise<T | ResponseError<any>>((resolve) => {
|
||||
setImmediate(() => {
|
||||
runtime.timer.setImmediate(() => {
|
||||
if (token.isCancellationRequested) {
|
||||
resolve(cancelValue());
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"vscode-extension-telemetry": "0.1.7",
|
||||
"vscode-nls": "^4.0.0"
|
||||
"vscode-nls": "^5.0.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -90,7 +90,7 @@ vscode-extension-telemetry@0.1.7:
|
|||
dependencies:
|
||||
applicationinsights "1.7.4"
|
||||
|
||||
vscode-nls@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.0.0.tgz#4001c8a6caba5cedb23a9c5ce1090395c0e44002"
|
||||
integrity sha512-qCfdzcH+0LgQnBpZA53bA32kzp9rpq/f66Som577ObeuDlFIrtbEJ+A/+CCxjIh4G8dpJYNCKIsxpRAHIfsbNw==
|
||||
vscode-nls@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.0.tgz#99f0da0bd9ea7cda44e565a74c54b1f2bc257840"
|
||||
integrity sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
const withDefaults = require('../shared.webpack.config');
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
|
||||
const config = withDefaults({
|
||||
context: path.join(__dirname, 'client'),
|
||||
|
@ -22,7 +21,5 @@ const config = withDefaults({
|
|||
}
|
||||
});
|
||||
|
||||
// add plugin, don't replace inherited
|
||||
config.plugins.push(new webpack.IgnorePlugin(/vertx/)); // request-light dependency
|
||||
|
||||
module.exports = config;
|
||||
|
|
|
@ -134,7 +134,7 @@
|
|||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"request-light": "^0.4.0",
|
||||
"request-light": "^0.5.2",
|
||||
"vscode-extension-telemetry": "0.1.7",
|
||||
"vscode-languageclient": "^7.0.0",
|
||||
"vscode-nls": "^5.0.0"
|
||||
|
|
|
@ -18,6 +18,7 @@ module.exports = withBrowserDefaults({
|
|||
output: {
|
||||
filename: 'jsonServerMain.js',
|
||||
path: path.join(__dirname, 'dist', 'browser'),
|
||||
libraryTarget: 'var'
|
||||
libraryTarget: 'var',
|
||||
library: 'serverExportVar'
|
||||
}
|
||||
});
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
const withDefaults = require('../../shared.webpack.config');
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
|
||||
const config = withDefaults({
|
||||
context: path.join(__dirname),
|
||||
|
@ -22,7 +21,4 @@ const config = withDefaults({
|
|||
}
|
||||
});
|
||||
|
||||
// add plugin, don't replace inherited
|
||||
config.plugins.push(new webpack.IgnorePlugin(/vertx/)); // request-light dependency
|
||||
|
||||
module.exports = config;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
"main": "./out/node/jsonServerMain",
|
||||
"dependencies": {
|
||||
"jsonc-parser": "^3.0.0",
|
||||
"request-light": "^0.4.0",
|
||||
"request-light": "^0.5.2",
|
||||
"vscode-json-languageservice": "^4.1.5",
|
||||
"vscode-languageserver": "^7.0.0",
|
||||
"vscode-uri": "^3.0.2"
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { createConnection, BrowserMessageReader, BrowserMessageWriter } from 'vscode-languageserver/browser';
|
||||
import { startServer } from '../jsonServer';
|
||||
import { createConnection, BrowserMessageReader, BrowserMessageWriter, Disposable } from 'vscode-languageserver/browser';
|
||||
import { RuntimeEnvironment, startServer } from '../jsonServer';
|
||||
|
||||
declare let self: any;
|
||||
|
||||
|
@ -13,4 +13,17 @@ const messageWriter = new BrowserMessageWriter(self);
|
|||
|
||||
const connection = createConnection(messageReader, messageWriter);
|
||||
|
||||
startServer(connection, {});
|
||||
const runtime: RuntimeEnvironment = {
|
||||
timer: {
|
||||
setImmediate(callback: (...args: any[]) => void, ...args: any[]): Disposable {
|
||||
const handle = setTimeout(callback, 0, ...args);
|
||||
return { dispose: () => clearTimeout(handle) };
|
||||
},
|
||||
setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): Disposable {
|
||||
const handle = setTimeout(callback, ms, ...args);
|
||||
return { dispose: () => clearTimeout(handle) };
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
startServer(connection, runtime);
|
||||
|
|
|
@ -48,6 +48,10 @@ export interface RuntimeEnvironment {
|
|||
file?: RequestService;
|
||||
http?: RequestService
|
||||
configureHttpRequests?(proxy: string, strictSSL: boolean): void;
|
||||
readonly timer: {
|
||||
setImmediate(callback: (...args: any[]) => void, ...args: any[]): Disposable;
|
||||
setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): Disposable;
|
||||
}
|
||||
}
|
||||
|
||||
export function startServer(connection: Connection, runtime: RuntimeEnvironment) {
|
||||
|
@ -171,13 +175,19 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
|
||||
|
||||
const limitExceededWarnings = function () {
|
||||
const pendingWarnings: { [uri: string]: { features: { [name: string]: string }; timeout?: NodeJS.Timeout; } } = {};
|
||||
const pendingWarnings: { [uri: string]: { features: { [name: string]: string }; timeout?: Disposable; } } = {};
|
||||
|
||||
const showLimitedNotification = (uri: string, resultLimit: number) => {
|
||||
const warning = pendingWarnings[uri];
|
||||
connection.sendNotification(ResultLimitReachedNotification.type, `${basename(uri)}: For performance reasons, ${Object.keys(warning.features).join(' and ')} have been limited to ${resultLimit} items.`);
|
||||
warning.timeout = undefined;
|
||||
};
|
||||
|
||||
return {
|
||||
cancel(uri: string) {
|
||||
const warning = pendingWarnings[uri];
|
||||
if (warning && warning.timeout) {
|
||||
clearTimeout(warning.timeout);
|
||||
warning.timeout.dispose();
|
||||
delete pendingWarnings[uri];
|
||||
}
|
||||
},
|
||||
|
@ -191,13 +201,11 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
return;
|
||||
}
|
||||
warning.features[name] = name;
|
||||
warning.timeout.refresh();
|
||||
warning.timeout.dispose();
|
||||
warning.timeout = runtime.timer.setTimeout(() => showLimitedNotification(uri, resultLimit), 2000);
|
||||
} else {
|
||||
warning = { features: { [name]: name } };
|
||||
warning.timeout = setTimeout(() => {
|
||||
connection.sendNotification(ResultLimitReachedNotification.type, `${basename(uri)}: For performance reasons, ${Object.keys(warning.features).join(' and ')} have been limited to ${resultLimit} items.`);
|
||||
warning.timeout = undefined;
|
||||
}, 2000);
|
||||
warning.timeout = runtime.timer.setTimeout(() => showLimitedNotification(uri, resultLimit), 2000);
|
||||
pendingWarnings[uri] = warning;
|
||||
}
|
||||
};
|
||||
|
@ -316,20 +324,20 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
connection.sendDiagnostics({ uri: event.document.uri, diagnostics: [] });
|
||||
});
|
||||
|
||||
const pendingValidationRequests: { [uri: string]: NodeJS.Timer; } = {};
|
||||
const pendingValidationRequests: { [uri: string]: Disposable; } = {};
|
||||
const validationDelayMs = 300;
|
||||
|
||||
function cleanPendingValidation(textDocument: TextDocument): void {
|
||||
const request = pendingValidationRequests[textDocument.uri];
|
||||
if (request) {
|
||||
clearTimeout(request);
|
||||
request.dispose();
|
||||
delete pendingValidationRequests[textDocument.uri];
|
||||
}
|
||||
}
|
||||
|
||||
function triggerValidation(textDocument: TextDocument): void {
|
||||
cleanPendingValidation(textDocument);
|
||||
pendingValidationRequests[textDocument.uri] = setTimeout(() => {
|
||||
pendingValidationRequests[textDocument.uri] = runtime.timer.setTimeout(() => {
|
||||
delete pendingValidationRequests[textDocument.uri];
|
||||
validateTextDocument(textDocument);
|
||||
}, validationDelayMs);
|
||||
|
@ -351,7 +359,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
|
||||
const documentSettings: DocumentLanguageSettings = textDocument.languageId === 'jsonc' ? { comments: 'ignore', trailingCommas: 'warning' } : { comments: 'error', trailingCommas: 'error' };
|
||||
languageService.doValidation(textDocument, jsonDocument, documentSettings).then(diagnostics => {
|
||||
setImmediate(() => {
|
||||
runtime.timer.setImmediate(() => {
|
||||
const currDocument = documents.get(textDocument.uri);
|
||||
if (currDocument && currDocument.version === version) {
|
||||
respond(diagnostics); // Send the computed diagnostics to VSCode.
|
||||
|
@ -388,7 +396,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
}
|
||||
|
||||
connection.onCompletion((textDocumentPosition, token) => {
|
||||
return runSafeAsync(async () => {
|
||||
return runSafeAsync(runtime, async () => {
|
||||
const document = documents.get(textDocumentPosition.textDocument.uri);
|
||||
if (document) {
|
||||
const jsonDocument = getJSONDocument(document);
|
||||
|
@ -399,7 +407,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.onHover((textDocumentPositionParams, token) => {
|
||||
return runSafeAsync(async () => {
|
||||
return runSafeAsync(runtime, async () => {
|
||||
const document = documents.get(textDocumentPositionParams.textDocument.uri);
|
||||
if (document) {
|
||||
const jsonDocument = getJSONDocument(document);
|
||||
|
@ -410,7 +418,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.onDocumentSymbol((documentSymbolParams, token) => {
|
||||
return runSafe(() => {
|
||||
return runSafe(runtime, () => {
|
||||
const document = documents.get(documentSymbolParams.textDocument.uri);
|
||||
if (document) {
|
||||
const jsonDocument = getJSONDocument(document);
|
||||
|
@ -439,15 +447,15 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
}
|
||||
|
||||
connection.onDocumentRangeFormatting((formatParams, token) => {
|
||||
return runSafe(() => onFormat(formatParams.textDocument, formatParams.range, formatParams.options), [], `Error while formatting range for ${formatParams.textDocument.uri}`, token);
|
||||
return runSafe(runtime, () => onFormat(formatParams.textDocument, formatParams.range, formatParams.options), [], `Error while formatting range for ${formatParams.textDocument.uri}`, token);
|
||||
});
|
||||
|
||||
connection.onDocumentFormatting((formatParams, token) => {
|
||||
return runSafe(() => onFormat(formatParams.textDocument, undefined, formatParams.options), [], `Error while formatting ${formatParams.textDocument.uri}`, token);
|
||||
return runSafe(runtime, () => onFormat(formatParams.textDocument, undefined, formatParams.options), [], `Error while formatting ${formatParams.textDocument.uri}`, token);
|
||||
});
|
||||
|
||||
connection.onDocumentColor((params, token) => {
|
||||
return runSafeAsync(async () => {
|
||||
return runSafeAsync(runtime, async () => {
|
||||
const document = documents.get(params.textDocument.uri);
|
||||
if (document) {
|
||||
const onResultLimitExceeded = limitExceededWarnings.onResultLimitExceeded(document.uri, resultLimit, 'document colors');
|
||||
|
@ -459,7 +467,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.onColorPresentation((params, token) => {
|
||||
return runSafe(() => {
|
||||
return runSafe(runtime, () => {
|
||||
const document = documents.get(params.textDocument.uri);
|
||||
if (document) {
|
||||
const jsonDocument = getJSONDocument(document);
|
||||
|
@ -470,7 +478,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.onFoldingRanges((params, token) => {
|
||||
return runSafe(() => {
|
||||
return runSafe(runtime, () => {
|
||||
const document = documents.get(params.textDocument.uri);
|
||||
if (document) {
|
||||
const onRangeLimitExceeded = limitExceededWarnings.onResultLimitExceeded(document.uri, foldingRangeLimit, 'folding ranges');
|
||||
|
@ -482,7 +490,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
|
||||
|
||||
connection.onSelectionRanges((params, token) => {
|
||||
return runSafe(() => {
|
||||
return runSafe(runtime, () => {
|
||||
const document = documents.get(params.textDocument.uri);
|
||||
if (document) {
|
||||
const jsonDocument = getJSONDocument(document);
|
||||
|
@ -493,7 +501,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||
});
|
||||
|
||||
connection.onDocumentLinks((params, token) => {
|
||||
return runSafeAsync(async () => {
|
||||
return runSafeAsync(runtime, async () => {
|
||||
const document = documents.get(params.textDocument.uri);
|
||||
if (document) {
|
||||
const jsonDocument = getJSONDocument(document);
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { createConnection, Connection } from 'vscode-languageserver/node';
|
||||
import { createConnection, Connection, Disposable } from 'vscode-languageserver/node';
|
||||
import { formatError } from '../utils/runner';
|
||||
import { startServer } from '../jsonServer';
|
||||
import { RuntimeEnvironment, startServer } from '../jsonServer';
|
||||
import { RequestService } from '../requests';
|
||||
|
||||
import { xhr, XHRResponse, configure as configureHttpRequests, getErrorStatusDescription } from 'request-light';
|
||||
|
@ -51,5 +51,22 @@ function getFileRequestService(): RequestService {
|
|||
};
|
||||
}
|
||||
|
||||
const runtime: RuntimeEnvironment = {
|
||||
timer: {
|
||||
setImmediate(callback: (...args: any[]) => void, ...args: any[]): Disposable {
|
||||
const handle = setImmediate(callback, ...args);
|
||||
return { dispose: () => clearImmediate(handle) };
|
||||
},
|
||||
setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): Disposable {
|
||||
const handle = setTimeout(callback, ms, ...args);
|
||||
return { dispose: () => clearTimeout(handle) };
|
||||
}
|
||||
},
|
||||
file: getFileRequestService(),
|
||||
http: getHTTPRequestService(),
|
||||
configureHttpRequests
|
||||
};
|
||||
|
||||
startServer(connection, { file: getFileRequestService(), http: getHTTPRequestService(), configureHttpRequests });
|
||||
|
||||
|
||||
startServer(connection, runtime);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { CancellationToken, ResponseError, LSPErrorCodes } from 'vscode-languageserver';
|
||||
import { RuntimeEnvironment } from '../jsonServer';
|
||||
|
||||
export function formatError(message: string, err: any): string {
|
||||
if (err instanceof Error) {
|
||||
|
@ -17,9 +18,9 @@ export function formatError(message: string, err: any): string {
|
|||
return message;
|
||||
}
|
||||
|
||||
export function runSafeAsync<T>(func: () => Thenable<T>, errorVal: T, errorMessage: string, token: CancellationToken): Thenable<T | ResponseError<any>> {
|
||||
export function runSafeAsync<T>(runtime: RuntimeEnvironment, func: () => Thenable<T>, errorVal: T, errorMessage: string, token: CancellationToken): Thenable<T | ResponseError<any>> {
|
||||
return new Promise<T | ResponseError<any>>((resolve) => {
|
||||
setImmediate(() => {
|
||||
runtime.timer.setImmediate(() => {
|
||||
if (token.isCancellationRequested) {
|
||||
resolve(cancelValue());
|
||||
}
|
||||
|
@ -38,9 +39,9 @@ export function runSafeAsync<T>(func: () => Thenable<T>, errorVal: T, errorMessa
|
|||
});
|
||||
}
|
||||
|
||||
export function runSafe<T, E>(func: () => T, errorVal: T, errorMessage: string, token: CancellationToken): Thenable<T | ResponseError<E>> {
|
||||
export function runSafe<T, E>(runtime: RuntimeEnvironment, func: () => T, errorVal: T, errorMessage: string, token: CancellationToken): Thenable<T | ResponseError<E>> {
|
||||
return new Promise<T | ResponseError<E>>((resolve) => {
|
||||
setImmediate(() => {
|
||||
runtime.timer.setImmediate(() => {
|
||||
if (token.isCancellationRequested) {
|
||||
resolve(cancelValue());
|
||||
} else {
|
||||
|
|
|
@ -12,20 +12,6 @@
|
|||
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.43.tgz#26bcbb0595b305400e8ceaf9a127a7f905ae49c8"
|
||||
integrity sha512-3pwDJjp1PWacPTpH0LcfhgjvurQvrZFBrC6xxjaUEZ7ifUtT32jtjPxEMMblpqd2Mvx+k8haqQJLQxolyGN/cQ==
|
||||
|
||||
agent-base@4:
|
||||
version "4.1.2"
|
||||
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.1.2.tgz#80fa6cde440f4dcf9af2617cf246099b5d99f0c8"
|
||||
integrity sha512-VE6QoEdaugY86BohRtfGmTDabxdU5sCKOkbcPA6PXKJsRzEi/7A3RCTxJal1ft/4qSfPht5/iQLhMh/wzSkkNw==
|
||||
dependencies:
|
||||
es6-promisify "^5.0.0"
|
||||
|
||||
agent-base@^4.3.0:
|
||||
version "4.3.0"
|
||||
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee"
|
||||
integrity sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==
|
||||
dependencies:
|
||||
es6-promisify "^5.0.0"
|
||||
|
||||
balanced-match@^1.0.0:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
|
||||
|
@ -44,41 +30,6 @@ concat-map@0.0.1:
|
|||
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
||||
integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=
|
||||
|
||||
debug@3.1.0, debug@^3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
|
||||
integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==
|
||||
dependencies:
|
||||
ms "2.0.0"
|
||||
|
||||
es6-promise@^4.0.3:
|
||||
version "4.1.1"
|
||||
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.1.1.tgz#8811e90915d9a0dba36274f0b242dbda78f9c92a"
|
||||
integrity sha512-OaU1hHjgJf+b0NzsxCg7NdIYERD6Hy/PEmFLTjw+b65scuisG3Kt4QoTvJ66BBkPZ581gr0kpoVzKnxniM8nng==
|
||||
|
||||
es6-promisify@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203"
|
||||
integrity sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=
|
||||
dependencies:
|
||||
es6-promise "^4.0.3"
|
||||
|
||||
http-proxy-agent@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz#e4821beef5b2142a2026bd73926fe537631c5405"
|
||||
integrity sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg==
|
||||
dependencies:
|
||||
agent-base "4"
|
||||
debug "3.1.0"
|
||||
|
||||
https-proxy-agent@^2.2.4:
|
||||
version "2.2.4"
|
||||
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz#4ee7a737abd92678a293d9b34a1af4d0d08c787b"
|
||||
integrity sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==
|
||||
dependencies:
|
||||
agent-base "^4.3.0"
|
||||
debug "^3.1.0"
|
||||
|
||||
jsonc-parser@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.0.0.tgz#abdd785701c7e7eaca8a9ec8cf070ca51a745a22"
|
||||
|
@ -91,19 +42,10 @@ minimatch@^3.0.4:
|
|||
dependencies:
|
||||
brace-expansion "^1.1.7"
|
||||
|
||||
ms@2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
|
||||
integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=
|
||||
|
||||
request-light@^0.4.0:
|
||||
version "0.4.0"
|
||||
resolved "https://registry.yarnpkg.com/request-light/-/request-light-0.4.0.tgz#c6b91ef00b18cb0de75d2127e55b3a2c9f7f90f9"
|
||||
integrity sha512-fimzjIVw506FBZLspTAXHdpvgvQebyjpNyLRd0e6drPPRq7gcrROeGWRyF81wLqFg5ijPgnOQbmfck5wdTqpSA==
|
||||
dependencies:
|
||||
http-proxy-agent "^2.1.0"
|
||||
https-proxy-agent "^2.2.4"
|
||||
vscode-nls "^4.1.2"
|
||||
request-light@^0.5.2:
|
||||
version "0.5.2"
|
||||
resolved "https://registry.yarnpkg.com/request-light/-/request-light-0.5.2.tgz#da70c743d37aaa9c0db61fa1b8e425521ce54ff0"
|
||||
integrity sha512-8Gvq+Uh19/5qg0V7tKYUqrnlXbmkAiL6Y5mKxi8ww0Dw8hhlhtP9B4oSioioPDYtG8+YAfmRGnrI7syi5uZsuw==
|
||||
|
||||
vscode-json-languageservice@^4.1.5:
|
||||
version "4.1.5"
|
||||
|
@ -147,11 +89,6 @@ vscode-languageserver@^7.0.0:
|
|||
dependencies:
|
||||
vscode-languageserver-protocol "3.16.0"
|
||||
|
||||
vscode-nls@^4.1.2:
|
||||
version "4.1.2"
|
||||
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.1.2.tgz#ca8bf8bb82a0987b32801f9fddfdd2fb9fd3c167"
|
||||
integrity sha512-7bOHxPsfyuCqmP+hZXscLhiHwe7CSuFE4hyhbs22xPIhQ4jv99FcR4eBzfYYVLP356HNFpdvz63FFb/xw6T4Iw==
|
||||
|
||||
vscode-nls@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.0.tgz#99f0da0bd9ea7cda44e565a74c54b1f2bc257840"
|
||||
|
|
|
@ -7,20 +7,6 @@
|
|||
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.43.tgz#26bcbb0595b305400e8ceaf9a127a7f905ae49c8"
|
||||
integrity sha512-3pwDJjp1PWacPTpH0LcfhgjvurQvrZFBrC6xxjaUEZ7ifUtT32jtjPxEMMblpqd2Mvx+k8haqQJLQxolyGN/cQ==
|
||||
|
||||
agent-base@4:
|
||||
version "4.2.1"
|
||||
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.2.1.tgz#d89e5999f797875674c07d87f260fc41e83e8ca9"
|
||||
integrity sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg==
|
||||
dependencies:
|
||||
es6-promisify "^5.0.0"
|
||||
|
||||
agent-base@^4.3.0:
|
||||
version "4.3.0"
|
||||
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee"
|
||||
integrity sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==
|
||||
dependencies:
|
||||
es6-promisify "^5.0.0"
|
||||
|
||||
applicationinsights@1.7.4:
|
||||
version "1.7.4"
|
||||
resolved "https://registry.yarnpkg.com/applicationinsights/-/applicationinsights-1.7.4.tgz#e7d96435594d893b00cf49f70a5927105dbb8749"
|
||||
|
@ -81,20 +67,6 @@ continuation-local-storage@^3.2.1:
|
|||
async-listener "^0.6.0"
|
||||
emitter-listener "^1.1.1"
|
||||
|
||||
debug@3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
|
||||
integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==
|
||||
dependencies:
|
||||
ms "2.0.0"
|
||||
|
||||
debug@^3.1.0:
|
||||
version "3.2.6"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b"
|
||||
integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==
|
||||
dependencies:
|
||||
ms "^2.1.1"
|
||||
|
||||
diagnostic-channel-publishers@^0.3.3:
|
||||
version "0.3.5"
|
||||
resolved "https://registry.yarnpkg.com/diagnostic-channel-publishers/-/diagnostic-channel-publishers-0.3.5.tgz#a84a05fd6cc1d7619fdd17791c17e540119a7536"
|
||||
|
@ -114,34 +86,6 @@ emitter-listener@^1.0.1, emitter-listener@^1.1.1:
|
|||
dependencies:
|
||||
shimmer "^1.2.0"
|
||||
|
||||
es6-promise@^4.0.3:
|
||||
version "4.2.6"
|
||||
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.6.tgz#b685edd8258886365ea62b57d30de28fadcd974f"
|
||||
integrity sha512-aRVgGdnmW2OiySVPUC9e6m+plolMAJKjZnQlCwNSuK5yQ0JN61DZSO1X1Ufd1foqWRAlig0rhduTCHe7sVtK5Q==
|
||||
|
||||
es6-promisify@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203"
|
||||
integrity sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=
|
||||
dependencies:
|
||||
es6-promise "^4.0.3"
|
||||
|
||||
http-proxy-agent@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz#e4821beef5b2142a2026bd73926fe537631c5405"
|
||||
integrity sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg==
|
||||
dependencies:
|
||||
agent-base "4"
|
||||
debug "3.1.0"
|
||||
|
||||
https-proxy-agent@^2.2.4:
|
||||
version "2.2.4"
|
||||
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz#4ee7a737abd92678a293d9b34a1af4d0d08c787b"
|
||||
integrity sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==
|
||||
dependencies:
|
||||
agent-base "^4.3.0"
|
||||
debug "^3.1.0"
|
||||
|
||||
lru-cache@^6.0.0:
|
||||
version "6.0.0"
|
||||
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94"
|
||||
|
@ -156,24 +100,10 @@ minimatch@^3.0.4:
|
|||
dependencies:
|
||||
brace-expansion "^1.1.7"
|
||||
|
||||
ms@2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
|
||||
integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=
|
||||
|
||||
ms@^2.1.1:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a"
|
||||
integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==
|
||||
|
||||
request-light@^0.4.0:
|
||||
version "0.4.0"
|
||||
resolved "https://registry.yarnpkg.com/request-light/-/request-light-0.4.0.tgz#c6b91ef00b18cb0de75d2127e55b3a2c9f7f90f9"
|
||||
integrity sha512-fimzjIVw506FBZLspTAXHdpvgvQebyjpNyLRd0e6drPPRq7gcrROeGWRyF81wLqFg5ijPgnOQbmfck5wdTqpSA==
|
||||
dependencies:
|
||||
http-proxy-agent "^2.1.0"
|
||||
https-proxy-agent "^2.2.4"
|
||||
vscode-nls "^4.1.2"
|
||||
request-light@^0.5.2:
|
||||
version "0.5.2"
|
||||
resolved "https://registry.yarnpkg.com/request-light/-/request-light-0.5.2.tgz#da70c743d37aaa9c0db61fa1b8e425521ce54ff0"
|
||||
integrity sha512-8Gvq+Uh19/5qg0V7tKYUqrnlXbmkAiL6Y5mKxi8ww0Dw8hhlhtP9B4oSioioPDYtG8+YAfmRGnrI7syi5uZsuw==
|
||||
|
||||
semver@^5.3.0:
|
||||
version "5.5.0"
|
||||
|
@ -236,11 +166,6 @@ vscode-languageserver-types@3.16.0:
|
|||
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0.tgz#ecf393fc121ec6974b2da3efb3155644c514e247"
|
||||
integrity sha512-k8luDIWJWyenLc5ToFQQMaSrqCHiLwyKPHKPQZ5zz21vM+vIVUSvsRpcbiECH4WR88K2XZqc4ScRcZ7nk/jbeA==
|
||||
|
||||
vscode-nls@^4.1.2:
|
||||
version "4.1.2"
|
||||
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.1.2.tgz#ca8bf8bb82a0987b32801f9fddfdd2fb9fd3c167"
|
||||
integrity sha512-7bOHxPsfyuCqmP+hZXscLhiHwe7CSuFE4hyhbs22xPIhQ4jv99FcR4eBzfYYVLP356HNFpdvz63FFb/xw6T4Iw==
|
||||
|
||||
vscode-nls@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.0.tgz#99f0da0bd9ea7cda44e565a74c54b1f2bc257840"
|
||||
|
|
|
@ -356,7 +356,7 @@
|
|||
"markdown-it": "^12.0.3",
|
||||
"markdown-it-front-matter": "^0.2.1",
|
||||
"vscode-extension-telemetry": "0.1.7",
|
||||
"vscode-nls": "^4.0.0"
|
||||
"vscode-nls": "^5.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/highlight.js": "10.1.0",
|
||||
|
|
|
@ -152,7 +152,7 @@ class MarkdownPreview extends Disposable implements WebviewResourceProvider {
|
|||
}
|
||||
|
||||
this._register(_contributionProvider.onContributionsChanged(() => {
|
||||
setImmediate(() => this.refresh());
|
||||
setTimeout(() => this.refresh(), 0);
|
||||
}));
|
||||
|
||||
this._register(vscode.workspace.onDidChangeTextDocument(event => {
|
||||
|
|
|
@ -182,7 +182,7 @@ vscode-extension-telemetry@0.1.7:
|
|||
dependencies:
|
||||
applicationinsights "1.7.4"
|
||||
|
||||
vscode-nls@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.0.0.tgz#4001c8a6caba5cedb23a9c5ce1090395c0e44002"
|
||||
integrity sha512-qCfdzcH+0LgQnBpZA53bA32kzp9rpq/f66Som577ObeuDlFIrtbEJ+A/+CCxjIh4G8dpJYNCKIsxpRAHIfsbNw==
|
||||
vscode-nls@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.0.tgz#99f0da0bd9ea7cda44e565a74c54b1f2bc257840"
|
||||
integrity sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==
|
||||
|
|
|
@ -156,7 +156,7 @@
|
|||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"vscode-nls": "^4.0.0"
|
||||
"vscode-nls": "^5.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "14.x"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.43.tgz#26bcbb0595b305400e8ceaf9a127a7f905ae49c8"
|
||||
integrity sha512-3pwDJjp1PWacPTpH0LcfhgjvurQvrZFBrC6xxjaUEZ7ifUtT32jtjPxEMMblpqd2Mvx+k8haqQJLQxolyGN/cQ==
|
||||
|
||||
vscode-nls@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.0.0.tgz#4001c8a6caba5cedb23a9c5ce1090395c0e44002"
|
||||
integrity sha512-qCfdzcH+0LgQnBpZA53bA32kzp9rpq/f66Som577ObeuDlFIrtbEJ+A/+CCxjIh4G8dpJYNCKIsxpRAHIfsbNw==
|
||||
vscode-nls@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.0.tgz#99f0da0bd9ea7cda44e565a74c54b1f2bc257840"
|
||||
integrity sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const withDefaults = require('../shared.webpack.config');
|
||||
|
||||
module.exports = withDefaults({
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
"stream": "0.0.2",
|
||||
"uuid": "^8.2.0",
|
||||
"vscode-extension-telemetry": "0.1.7",
|
||||
"vscode-nls": "^4.1.1"
|
||||
"vscode-nls": "^5.0.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -229,7 +229,7 @@ vscode-extension-telemetry@0.1.7:
|
|||
dependencies:
|
||||
applicationinsights "1.7.4"
|
||||
|
||||
vscode-nls@^4.1.1:
|
||||
version "4.1.1"
|
||||
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.1.1.tgz#f9916b64e4947b20322defb1e676a495861f133c"
|
||||
integrity sha512-4R+2UoUUU/LdnMnFjePxfLqNhBS8lrAFyX7pjb2ud/lqDkrUavFUTcG7wR0HBZFakae0Q6KLBFjMS6W93F403A==
|
||||
vscode-nls@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.0.tgz#99f0da0bd9ea7cda44e565a74c54b1f2bc257840"
|
||||
integrity sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
const withBrowserDefaults = require('../shared.webpack.config').browser;
|
||||
|
||||
module.exports = withBrowserDefaults({
|
||||
const config = withBrowserDefaults({
|
||||
context: __dirname,
|
||||
entry: {
|
||||
extension: './src/npmBrowserMain.ts'
|
||||
|
@ -17,8 +17,11 @@ module.exports = withBrowserDefaults({
|
|||
output: {
|
||||
filename: 'npmBrowserMain.js'
|
||||
},
|
||||
node: {
|
||||
'child_process': 'empty',
|
||||
'which': 'empty'
|
||||
resolve: {
|
||||
fallback: {
|
||||
'child_process': false
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = config;
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
|
||||
const withDefaults = require('../shared.webpack.config');
|
||||
|
||||
module.exports = withDefaults({
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
"find-yarn-workspace-root": "^2.0.0",
|
||||
"jsonc-parser": "^2.2.1",
|
||||
"minimatch": "^3.0.4",
|
||||
"request-light": "^0.4.0",
|
||||
"vscode-nls": "^4.1.1",
|
||||
"request-light": "^0.5.2",
|
||||
"vscode-nls": "^5.0.0",
|
||||
"which": "^2.0.2",
|
||||
"which-pm": "^2.0.0"
|
||||
},
|
||||
|
|
|
@ -63,7 +63,7 @@ export class BowerJSONContribution implements IJSONContribution {
|
|||
|
||||
return this.xhr({
|
||||
url: queryUrl,
|
||||
agent: USER_AGENT
|
||||
headers: { agent: USER_AGENT }
|
||||
}).then((success) => {
|
||||
if (success.status === 200) {
|
||||
try {
|
||||
|
@ -165,7 +165,7 @@ export class BowerJSONContribution implements IJSONContribution {
|
|||
|
||||
return this.xhr({
|
||||
url: queryUrl,
|
||||
agent: USER_AGENT
|
||||
headers: { agent: USER_AGENT }
|
||||
}).then((success) => {
|
||||
try {
|
||||
const obj = JSON.parse(success.responseText);
|
||||
|
|
|
@ -96,7 +96,7 @@ export class PackageJSONContribution implements IJSONContribution {
|
|||
queryUrl = `https://registry.npmjs.org/-/v1/search?size=${LIMIT}&text=${encodeURIComponent(currentWord)}`;
|
||||
return this.xhr({
|
||||
url: queryUrl,
|
||||
agent: USER_AGENT
|
||||
headers: { agent: USER_AGENT }
|
||||
}).then((success) => {
|
||||
if (success.status === 200) {
|
||||
try {
|
||||
|
@ -156,7 +156,7 @@ export class PackageJSONContribution implements IJSONContribution {
|
|||
let queryUrl = `https://registry.npmjs.com/-/v1/search?text=scope:${scope}%20${name}&size=250`;
|
||||
return this.xhr({
|
||||
url: queryUrl,
|
||||
agent: USER_AGENT
|
||||
headers: { agent: USER_AGENT }
|
||||
}).then((success) => {
|
||||
if (success.status === 200) {
|
||||
try {
|
||||
|
@ -311,7 +311,7 @@ export class PackageJSONContribution implements IJSONContribution {
|
|||
try {
|
||||
const success = await this.xhr({
|
||||
url: queryUrl,
|
||||
agent: USER_AGENT
|
||||
headers: { agent: USER_AGENT }
|
||||
});
|
||||
const obj = JSON.parse(success.responseText);
|
||||
return {
|
||||
|
|
|
@ -17,20 +17,6 @@
|
|||
resolved "https://registry.yarnpkg.com/@types/which/-/which-2.0.0.tgz#446d35586611dee657120de8e0457382a658fc25"
|
||||
integrity sha512-JHTNOEpZnACQdsTojWggn+SQ8IucfqEhtz7g8Z0G67WdSj4x3F0X5I2c/CVcl8z/QukGrIHeQ/N49v1au74XFQ==
|
||||
|
||||
agent-base@4:
|
||||
version "4.2.0"
|
||||
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.2.0.tgz#9838b5c3392b962bad031e6a4c5e1024abec45ce"
|
||||
integrity sha512-c+R/U5X+2zz2+UCrCFv6odQzJdoqI+YecuhnAJLa1zYaMc13zPfwMwZrr91Pd1DYNo/yPRbiM4WVf9whgwFsIg==
|
||||
dependencies:
|
||||
es6-promisify "^5.0.0"
|
||||
|
||||
agent-base@^4.3.0:
|
||||
version "4.3.0"
|
||||
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee"
|
||||
integrity sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==
|
||||
dependencies:
|
||||
es6-promisify "^5.0.0"
|
||||
|
||||
argparse@1.0.9, argparse@^1.0.7:
|
||||
version "1.0.9"
|
||||
resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.9.tgz#73d83bc263f86e97f8cc4f6bae1b0e90a7d22c86"
|
||||
|
@ -63,25 +49,6 @@ concat-map@0.0.1:
|
|||
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
||||
integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=
|
||||
|
||||
debug@3.1.0, debug@^3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
|
||||
integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==
|
||||
dependencies:
|
||||
ms "2.0.0"
|
||||
|
||||
es6-promise@^4.0.3:
|
||||
version "4.2.4"
|
||||
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.4.tgz#dc4221c2b16518760bd8c39a52d8f356fc00ed29"
|
||||
integrity sha512-/NdNZVJg+uZgtm9eS3O6lrOLYmQag2DjdEXuPaHlZ6RuVqgqaVZfgYCepEIKsLqwdQArOPtC3XzRLqGGfT8KQQ==
|
||||
|
||||
es6-promisify@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203"
|
||||
integrity sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=
|
||||
dependencies:
|
||||
es6-promise "^4.0.3"
|
||||
|
||||
esprima@^4.0.0:
|
||||
version "4.0.1"
|
||||
resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
|
||||
|
@ -114,22 +81,6 @@ graceful-fs@^4.1.5:
|
|||
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb"
|
||||
integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==
|
||||
|
||||
http-proxy-agent@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz#e4821beef5b2142a2026bd73926fe537631c5405"
|
||||
integrity sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg==
|
||||
dependencies:
|
||||
agent-base "4"
|
||||
debug "3.1.0"
|
||||
|
||||
https-proxy-agent@^2.2.4:
|
||||
version "2.2.4"
|
||||
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz#4ee7a737abd92678a293d9b34a1af4d0d08c787b"
|
||||
integrity sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==
|
||||
dependencies:
|
||||
agent-base "^4.3.0"
|
||||
debug "^3.1.0"
|
||||
|
||||
is-number@^7.0.0:
|
||||
version "7.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b"
|
||||
|
@ -185,11 +136,6 @@ minimatch@^3.0.4:
|
|||
dependencies:
|
||||
brace-expansion "^1.1.7"
|
||||
|
||||
ms@2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
|
||||
integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=
|
||||
|
||||
p-limit@^2.2.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1"
|
||||
|
@ -224,14 +170,10 @@ pify@^4.0.1:
|
|||
resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231"
|
||||
integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==
|
||||
|
||||
request-light@^0.4.0:
|
||||
version "0.4.0"
|
||||
resolved "https://registry.yarnpkg.com/request-light/-/request-light-0.4.0.tgz#c6b91ef00b18cb0de75d2127e55b3a2c9f7f90f9"
|
||||
integrity sha512-fimzjIVw506FBZLspTAXHdpvgvQebyjpNyLRd0e6drPPRq7gcrROeGWRyF81wLqFg5ijPgnOQbmfck5wdTqpSA==
|
||||
dependencies:
|
||||
http-proxy-agent "^2.1.0"
|
||||
https-proxy-agent "^2.2.4"
|
||||
vscode-nls "^4.1.2"
|
||||
request-light@^0.5.2:
|
||||
version "0.5.2"
|
||||
resolved "https://registry.yarnpkg.com/request-light/-/request-light-0.5.2.tgz#da70c743d37aaa9c0db61fa1b8e425521ce54ff0"
|
||||
integrity sha512-8Gvq+Uh19/5qg0V7tKYUqrnlXbmkAiL6Y5mKxi8ww0Dw8hhlhtP9B4oSioioPDYtG8+YAfmRGnrI7syi5uZsuw==
|
||||
|
||||
sprintf-js@~1.0.2:
|
||||
version "1.0.3"
|
||||
|
@ -250,15 +192,10 @@ to-regex-range@^5.0.1:
|
|||
dependencies:
|
||||
is-number "^7.0.0"
|
||||
|
||||
vscode-nls@^4.1.1:
|
||||
version "4.1.1"
|
||||
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.1.1.tgz#f9916b64e4947b20322defb1e676a495861f133c"
|
||||
integrity sha512-4R+2UoUUU/LdnMnFjePxfLqNhBS8lrAFyX7pjb2ud/lqDkrUavFUTcG7wR0HBZFakae0Q6KLBFjMS6W93F403A==
|
||||
|
||||
vscode-nls@^4.1.2:
|
||||
version "4.1.2"
|
||||
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.1.2.tgz#ca8bf8bb82a0987b32801f9fddfdd2fb9fd3c167"
|
||||
integrity sha512-7bOHxPsfyuCqmP+hZXscLhiHwe7CSuFE4hyhbs22xPIhQ4jv99FcR4eBzfYYVLP356HNFpdvz63FFb/xw6T4Iw==
|
||||
vscode-nls@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.0.tgz#99f0da0bd9ea7cda44e565a74c54b1f2bc257840"
|
||||
integrity sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==
|
||||
|
||||
which-pm@^2.0.0:
|
||||
version "2.0.0"
|
||||
|
|
|
@ -16,12 +16,6 @@ const { NLSBundlePlugin } = require('vscode-nls-dev/lib/webpack-bundler');
|
|||
const { DefinePlugin } = require('webpack');
|
||||
|
||||
function withNodeDefaults(/**@type WebpackConfig*/extConfig) {
|
||||
// Need to find the top-most `package.json` file
|
||||
const folderName = path.relative(__dirname, extConfig.context).split(/[\\\/]/)[0];
|
||||
const pkgPath = path.join(__dirname, folderName, 'package.json');
|
||||
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
||||
const id = `${pkg.publisher}.${pkg.name}`;
|
||||
|
||||
/** @type WebpackConfig */
|
||||
let defaultConfig = {
|
||||
mode: 'none', // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
|
||||
|
@ -70,19 +64,28 @@ function withNodeDefaults(/**@type WebpackConfig*/extConfig) {
|
|||
},
|
||||
// yes, really source maps
|
||||
devtool: 'source-map',
|
||||
plugins: [
|
||||
new CopyWebpackPlugin({
|
||||
patterns: [
|
||||
{ from: 'src', to: '.', globOptions: { ignore: ['**/test/**', '**/*.ts'] }, noErrorOnMissing: true }
|
||||
]
|
||||
}),
|
||||
new NLSBundlePlugin(id)
|
||||
],
|
||||
plugins: nodePlugins(extConfig.context),
|
||||
};
|
||||
|
||||
return merge(defaultConfig, extConfig);
|
||||
}
|
||||
|
||||
function nodePlugins(context) {
|
||||
// Need to find the top-most `package.json` file
|
||||
const folderName = path.relative(__dirname, context).split(/[\\\/]/)[0];
|
||||
const pkgPath = path.join(__dirname, folderName, 'package.json');
|
||||
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
||||
const id = `${pkg.publisher}.${pkg.name}`;
|
||||
return [
|
||||
new CopyWebpackPlugin({
|
||||
patterns: [
|
||||
{ from: 'src', to: '.', globOptions: { ignore: ['**/test/**', '**/*.ts'] }, noErrorOnMissing: true }
|
||||
]
|
||||
}),
|
||||
new NLSBundlePlugin(id)
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
function withBrowserDefaults(/**@type WebpackConfig*/extConfig) {
|
||||
/** @type WebpackConfig */
|
||||
|
@ -93,8 +96,11 @@ function withBrowserDefaults(/**@type WebpackConfig*/extConfig) {
|
|||
mainFields: ['module', 'main'],
|
||||
extensions: ['.ts', '.js'], // support ts-files and js-files
|
||||
alias: {
|
||||
'vscode-nls': path.resolve(__dirname, '../build/polyfills/vscode-nls.js'),
|
||||
'vscode-extension-telemetry': path.resolve(__dirname, '../build/polyfills/vscode-extension-telemetry.js')
|
||||
},
|
||||
fallback: {
|
||||
'path': require.resolve('path-browserify'),
|
||||
'util': require.resolve('util')
|
||||
}
|
||||
},
|
||||
module: {
|
||||
|
@ -130,21 +136,30 @@ function withBrowserDefaults(/**@type WebpackConfig*/extConfig) {
|
|||
},
|
||||
// yes, really source maps
|
||||
devtool: 'source-map',
|
||||
plugins: [
|
||||
new CopyWebpackPlugin({
|
||||
patterns: [
|
||||
{ from: 'src', to: '.', globOptions: { ignore: ['**/test/**', '**/*.ts'] }, noErrorOnMissing: true }
|
||||
]
|
||||
}),
|
||||
new DefinePlugin({ WEBWORKER: JSON.stringify(true) })
|
||||
]
|
||||
plugins: browserPlugins
|
||||
};
|
||||
|
||||
return merge(defaultConfig, extConfig);
|
||||
}
|
||||
|
||||
const browserPlugins = [
|
||||
new CopyWebpackPlugin({
|
||||
patterns: [
|
||||
{ from: 'src', to: '.', globOptions: { ignore: ['**/test/**', '**/*.ts'] }, noErrorOnMissing: true }
|
||||
]
|
||||
}),
|
||||
new DefinePlugin({
|
||||
'process.env': JSON.stringify({}),
|
||||
'process.env.BROWSER_ENV': JSON.stringify('true')
|
||||
})
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
module.exports = withNodeDefaults;
|
||||
module.exports.node = withNodeDefaults;
|
||||
module.exports.browser = withBrowserDefaults;
|
||||
module.exports.nodePlugins = nodePlugins;
|
||||
module.exports.browserPlugins = browserPlugins;
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"vscode-extension-telemetry": "0.1.7",
|
||||
"vscode-nls": "^4.0.0"
|
||||
"vscode-nls": "^5.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "14.x",
|
||||
|
|
|
@ -100,7 +100,7 @@ vscode-extension-telemetry@0.1.7:
|
|||
dependencies:
|
||||
applicationinsights "1.7.4"
|
||||
|
||||
vscode-nls@^4.0.0:
|
||||
version "4.1.2"
|
||||
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.1.2.tgz#ca8bf8bb82a0987b32801f9fddfdd2fb9fd3c167"
|
||||
integrity sha512-7bOHxPsfyuCqmP+hZXscLhiHwe7CSuFE4hyhbs22xPIhQ4jv99FcR4eBzfYYVLP356HNFpdvz63FFb/xw6T4Iw==
|
||||
vscode-nls@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.0.tgz#99f0da0bd9ea7cda44e565a74c54b1f2bc257840"
|
||||
integrity sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==
|
||||
|
|
|
@ -1,8 +1,29 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es2019",
|
||||
"target": "es2020",
|
||||
"lib": [
|
||||
"es2019"
|
||||
"ES2016",
|
||||
"ES2017.Object",
|
||||
"ES2017.String",
|
||||
"ES2017.Intl",
|
||||
"ES2017.TypedArrays",
|
||||
"ES2018.AsyncIterable",
|
||||
"ES2018.AsyncGenerator",
|
||||
"ES2018.Promise",
|
||||
"ES2018.Regexp",
|
||||
"ES2018.Intl",
|
||||
"ES2019.Array",
|
||||
"ES2019.Object",
|
||||
"ES2019.String",
|
||||
"ES2019.Symbol",
|
||||
"ES2020.BigInt",
|
||||
"ES2020.Promise",
|
||||
"ES2020.String",
|
||||
"ES2020.Symbol.WellKnown",
|
||||
"ES2020.Intl",
|
||||
"ES2021.Promise",
|
||||
"ES2021.String",
|
||||
"ES2021.Weakref"
|
||||
],
|
||||
"module": "commonjs",
|
||||
"strict": true,
|
||||
|
|
|
@ -7,10 +7,11 @@
|
|||
|
||||
'use strict';
|
||||
const CopyPlugin = require('copy-webpack-plugin');
|
||||
const { lchmod } = require('graceful-fs');
|
||||
const Terser = require('terser');
|
||||
|
||||
const withBrowserDefaults = require('../shared.webpack.config').browser;
|
||||
const defaultConfig = require('../shared.webpack.config');
|
||||
const withBrowserDefaults = defaultConfig.browser;
|
||||
const browserPlugins = defaultConfig.browserPlugins;
|
||||
|
||||
const languages = [
|
||||
'zh-tw',
|
||||
|
@ -34,6 +35,8 @@ module.exports = withBrowserDefaults({
|
|||
extension: './src/extension.browser.ts',
|
||||
},
|
||||
plugins: [
|
||||
...browserPlugins, // add plugins, don't replace inherited
|
||||
|
||||
// @ts-ignore
|
||||
new CopyPlugin({
|
||||
patterns: [
|
||||
|
@ -62,7 +65,7 @@ module.exports = withBrowserDefaults({
|
|||
from: '../node_modules/typescript/lib/tsserver.js',
|
||||
to: 'typescript/tsserver.web.js',
|
||||
transform: (content) => {
|
||||
return Terser.minify(content.toString()).code;
|
||||
return Terser.minify(content.toString()).then(output => output.code);
|
||||
|
||||
},
|
||||
transformPath: (targetPath) => {
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
"semver": "5.5.1",
|
||||
"typescript-vscode-sh-plugin": "^0.7.3",
|
||||
"vscode-extension-telemetry": "0.1.7",
|
||||
"vscode-nls": "^4.1.1"
|
||||
"vscode-nls": "^5.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "14.x",
|
||||
|
|
|
@ -8,7 +8,7 @@ import type * as Proto from '../protocol';
|
|||
import { ITypeScriptServiceClient, ClientCapability } from '../typescriptService';
|
||||
import API from '../utils/api';
|
||||
import { coalesce } from '../utils/arrays';
|
||||
import { Delayer } from '../utils/async';
|
||||
import { Delayer, setImmediate } from '../utils/async';
|
||||
import { nulToken } from '../utils/cancellation';
|
||||
import { Disposable } from '../utils/dispose';
|
||||
import * as languageModeIds from '../utils/languageModeIds';
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { TypeScriptServiceConfiguration } from '../utils/configuration';
|
||||
import { setImmediate } from '../utils/async';
|
||||
import { Disposable } from '../utils/dispose';
|
||||
import { ITypeScriptVersionProvider, TypeScriptVersion } from './versionProvider';
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Disposable } from 'vscode';
|
||||
|
||||
export interface ITask<T> {
|
||||
(): T;
|
||||
}
|
||||
|
@ -60,3 +62,13 @@ export class Delayer<T> {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function setImmediate(callback: (...args: any[]) => void, ...args: any[]): Disposable {
|
||||
if (global.setImmediate) {
|
||||
const handle = global.setImmediate(callback, ...args);
|
||||
return { dispose: () => global.clearImmediate(handle) };
|
||||
} else {
|
||||
const handle = setTimeout(callback, 0, ...args);
|
||||
return { dispose: () => clearTimeout(handle) };
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ vscode-extension-telemetry@0.1.7:
|
|||
dependencies:
|
||||
applicationinsights "1.7.4"
|
||||
|
||||
vscode-nls@^4.1.1:
|
||||
version "4.1.2"
|
||||
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.1.2.tgz#ca8bf8bb82a0987b32801f9fddfdd2fb9fd3c167"
|
||||
integrity sha512-7bOHxPsfyuCqmP+hZXscLhiHwe7CSuFE4hyhbs22xPIhQ4jv99FcR4eBzfYYVLP356HNFpdvz63FFb/xw6T4Iw==
|
||||
vscode-nls@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.0.tgz#99f0da0bd9ea7cda44e565a74c54b1f2bc257840"
|
||||
integrity sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==
|
||||
|
|
10
package.json
10
package.json
|
@ -179,6 +179,7 @@
|
|||
"opn": "^6.0.0",
|
||||
"optimist": "0.3.5",
|
||||
"p-all": "^1.0.0",
|
||||
"path-browserify": "^1.0.1",
|
||||
"playwright": "1.12.3",
|
||||
"pump": "^1.0.1",
|
||||
"queue": "3.0.6",
|
||||
|
@ -190,8 +191,9 @@
|
|||
"source-map": "0.6.1",
|
||||
"source-map-support": "^0.3.2",
|
||||
"style-loader": "^1.0.0",
|
||||
"ts-loader": "^6.2.1",
|
||||
"ts-loader": "^9.2.3",
|
||||
"tsec": "0.1.4",
|
||||
"util": "^0.12.4",
|
||||
"typescript": "^4.4.0-dev.20210708",
|
||||
"typescript-formatter": "7.1.0",
|
||||
"underscore": "^1.12.1",
|
||||
|
@ -200,9 +202,9 @@
|
|||
"vscode-debugprotocol": "1.48.0-pre.0",
|
||||
"vscode-nls-dev": "^3.3.1",
|
||||
"vscode-telemetry-extractor": "^1.8.0",
|
||||
"webpack": "^4.43.0",
|
||||
"webpack-cli": "^3.3.12",
|
||||
"webpack-stream": "^5.2.1",
|
||||
"webpack": "^5.42.0",
|
||||
"webpack-cli": "^4.7.2",
|
||||
"webpack-stream": "^6.1.2",
|
||||
"xml2js": "^0.4.17",
|
||||
"yaserver": "^0.2.0"
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue