mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
[html] adopt SnippetString (#15573) and update to TS 2.0
This commit is contained in:
parent
a10e54ff79
commit
f37a51537b
|
@ -1,7 +1,7 @@
|
|||
// ATTENTION - THIS DIRECTORY CONTAINS THIRD PARTY OPEN SOURCE MATERIALS:
|
||||
[{
|
||||
"name": "js-beautify",
|
||||
"version": "1.6.2",
|
||||
"version": "1.6.4",
|
||||
"license": "MIT",
|
||||
"repositoryURL": "https://github.com/beautify-web/js-beautify"
|
||||
},{
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import * as path from 'path';
|
||||
|
||||
import { languages, workspace, ExtensionContext, IndentAction } from 'vscode';
|
||||
import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind, Range, RequestType, Protocol2Code } from 'vscode-languageclient';
|
||||
import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind, Range, RequestType } from 'vscode-languageclient';
|
||||
import { EMPTY_ELEMENTS } from './htmlEmptyTagsShared';
|
||||
import { activateColorDecorations } from './colorDecorators';
|
||||
|
||||
|
@ -15,7 +15,7 @@ import * as nls from 'vscode-nls';
|
|||
let localize = nls.loadMessageBundle();
|
||||
|
||||
namespace ColorSymbolRequest {
|
||||
export const type: RequestType<string, Range[], any> = { get method() { return 'css/colorSymbols'; } };
|
||||
export const type: RequestType<string, Range[], any, any> = { get method() { return 'css/colorSymbols'; }, _: null };
|
||||
}
|
||||
|
||||
export function activate(context: ExtensionContext) {
|
||||
|
@ -56,7 +56,7 @@ export function activate(context: ExtensionContext) {
|
|||
context.subscriptions.push(disposable);
|
||||
|
||||
let colorRequestor = (uri: string) => {
|
||||
return client.sendRequest(ColorSymbolRequest.type, uri).then(ranges => ranges.map(Protocol2Code.asRange));
|
||||
return client.sendRequest(ColorSymbolRequest.type, uri).then(ranges => ranges.map(client.protocol2CodeConverter.asRange));
|
||||
};
|
||||
disposable = activateColorDecorations(colorRequestor, { html: true, handlebars: true, razor: true });
|
||||
context.subscriptions.push(disposable);
|
||||
|
|
7
extensions/html/client/src/typings/ref.d.ts
vendored
7
extensions/html/client/src/typings/ref.d.ts
vendored
|
@ -3,9 +3,4 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
/// <reference path='../../../../../src/vs/vscode.d.ts'/>
|
||||
/// <reference path='../../../../../src/typings/mocha.d.ts'/>
|
||||
/// <reference path='../../../../../extensions/node.d.ts'/>
|
||||
/// <reference path='../../../../../extensions/lib.core.d.ts'/>
|
||||
/// <reference path='../../../../../extensions/declares.d.ts'/>
|
||||
/// <reference path='../../../node_modules/vscode-languageclient/lib/main.d.ts'/>
|
||||
/// <reference path='../../../../../src/vs/vscode.d.ts'/>
|
|
@ -1,11 +1,10 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"noLib": true,
|
||||
"target": "es5",
|
||||
"module": "commonjs",
|
||||
"outDir": "./out"
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
"outDir": "./out",
|
||||
"lib": [
|
||||
"es5", "es2015.promise"
|
||||
]
|
||||
}
|
||||
}
|
14
extensions/html/npm-shrinkwrap.json
generated
14
extensions/html/npm-shrinkwrap.json
generated
|
@ -3,19 +3,19 @@
|
|||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"vscode-jsonrpc": {
|
||||
"version": "2.4.0",
|
||||
"from": "vscode-jsonrpc@>=2.4.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-2.4.0.tgz"
|
||||
"version": "3.0.1-alpha.2",
|
||||
"from": "vscode-jsonrpc@>=3.0.1-alpha.2 <4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-3.0.1-alpha.2.tgz"
|
||||
},
|
||||
"vscode-languageclient": {
|
||||
"version": "2.6.4-next.1",
|
||||
"version": "3.0.1-alpha.2",
|
||||
"from": "vscode-languageclient@next",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-2.6.4-next.1.tgz"
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-3.0.1-alpha.2.tgz"
|
||||
},
|
||||
"vscode-languageserver-types": {
|
||||
"version": "1.0.5-next.1",
|
||||
"version": "3.0.1-alpha.2",
|
||||
"from": "vscode-languageserver-types@next",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-1.0.5-next.1.tgz"
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.0.1-alpha.2.tgz"
|
||||
},
|
||||
"vscode-nls": {
|
||||
"version": "1.0.7",
|
||||
|
|
|
@ -143,8 +143,12 @@
|
|||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"vscode-languageclient": "^2.6.4-next.1",
|
||||
"vscode-languageserver-types": "^1.0.5-next.1",
|
||||
"vscode-languageclient": "^3.0.1-alpha.2",
|
||||
"vscode-languageserver-types": "^3.0.1-alpha.2",
|
||||
"vscode-nls": "^1.0.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^6.0.51",
|
||||
"@types/mocha": "^2.2.33"
|
||||
}
|
||||
}
|
||||
|
|
24
extensions/html/server/npm-shrinkwrap.json
generated
24
extensions/html/server/npm-shrinkwrap.json
generated
|
@ -3,29 +3,29 @@
|
|||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"vscode-css-languageservice": {
|
||||
"version": "2.0.0-next.3",
|
||||
"version": "2.0.0-next.5",
|
||||
"from": "vscode-css-languageservice@next",
|
||||
"resolved": "https://registry.npmjs.org/vscode-css-languageservice/-/vscode-css-languageservice-2.0.0-next.3.tgz"
|
||||
"resolved": "https://registry.npmjs.org/vscode-css-languageservice/-/vscode-css-languageservice-2.0.0-next.5.tgz"
|
||||
},
|
||||
"vscode-html-languageservice": {
|
||||
"version": "1.0.1-next.4",
|
||||
"version": "2.0.0-next.1",
|
||||
"from": "vscode-html-languageservice@next",
|
||||
"resolved": "https://registry.npmjs.org/vscode-html-languageservice/-/vscode-html-languageservice-1.0.1-next.4.tgz"
|
||||
"resolved": "https://registry.npmjs.org/vscode-html-languageservice/-/vscode-html-languageservice-2.0.0-next.1.tgz"
|
||||
},
|
||||
"vscode-jsonrpc": {
|
||||
"version": "2.4.0",
|
||||
"from": "vscode-jsonrpc@>=2.4.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-2.4.0.tgz"
|
||||
"version": "3.0.1-alpha.2",
|
||||
"from": "vscode-jsonrpc@>=3.0.1-alpha.2 <4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-3.0.1-alpha.2.tgz"
|
||||
},
|
||||
"vscode-languageserver": {
|
||||
"version": "2.6.2-next.1",
|
||||
"version": "3.0.1-alpha.2",
|
||||
"from": "vscode-languageserver@next",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-2.6.2-next.1.tgz"
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-3.0.1-alpha.2.tgz"
|
||||
},
|
||||
"vscode-languageserver-types": {
|
||||
"version": "1.0.5-next.1",
|
||||
"from": "vscode-languageserver-types@>=1.0.5-next.1 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-1.0.5-next.1.tgz"
|
||||
"version": "3.0.1-alpha.2",
|
||||
"from": "vscode-languageserver-types@>=3.0.1-alpha.2 <4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.0.1-alpha.2.tgz"
|
||||
},
|
||||
"vscode-nls": {
|
||||
"version": "1.0.7",
|
||||
|
|
|
@ -8,15 +8,19 @@
|
|||
"node": "*"
|
||||
},
|
||||
"dependencies": {
|
||||
"vscode-css-languageservice": "^2.0.0-next.3",
|
||||
"vscode-html-languageservice": "^1.0.1-next.4",
|
||||
"vscode-languageserver": "^2.6.2-next.1",
|
||||
"vscode-nls": "^1.0.4",
|
||||
"vscode-css-languageservice": "^2.0.0-next.5",
|
||||
"vscode-html-languageservice": "^2.0.0-next.1",
|
||||
"vscode-languageserver": "^3.0.1-alpha.2",
|
||||
"vscode-nls": "^1.0.7",
|
||||
"vscode-uri": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^6.0.51",
|
||||
"@types/mocha": "^2.2.33"
|
||||
},
|
||||
"scripts": {
|
||||
"compile": "gulp compile-extension:json-server",
|
||||
"watch": "gulp watch-extension:json-server",
|
||||
"compile": "gulp compile-extension:html-server",
|
||||
"watch": "gulp watch-extension:html-server",
|
||||
"install-service-next": "npm install vscode-css-languageservice@next -f -S && npm install vscode-html-languageservice@next -f -S",
|
||||
"install-service-local": "npm install ../../../../vscode-css-languageservice -f -S && npm install ../../../../vscode-html-languageservice -f -S",
|
||||
"install-server-next": "npm install vscode-languageserver@next -f -S",
|
||||
|
|
|
@ -17,7 +17,7 @@ import * as nls from 'vscode-nls';
|
|||
nls.config(process.env['VSCODE_NLS_CONFIG']);
|
||||
|
||||
namespace ColorSymbolRequest {
|
||||
export const type: RequestType<string, Range[], any> = { get method() { return 'css/colorSymbols'; } };
|
||||
export const type: RequestType<string, Range[], any, any> = { get method() { return 'css/colorSymbols'; }, _: null };
|
||||
}
|
||||
|
||||
// Create a connection for the server
|
||||
|
|
1
extensions/html/server/src/test/ref.d.ts
vendored
Normal file
1
extensions/html/server/src/test/ref.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/// <reference path='../../node_modules/@types/mocha/index.d.ts'/>
|
112
extensions/html/server/src/typings/promise.d.ts
vendored
112
extensions/html/server/src/typings/promise.d.ts
vendored
|
@ -1,112 +0,0 @@
|
|||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
/**
|
||||
* The Thenable (E.g. PromiseLike) and Promise declarions are taken from TypeScript's
|
||||
* lib.core.es6.d.ts file. See above Copyright notice.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Thenable is a common denominator between ES6 promises, Q, jquery.Deferred, WinJS.Promise,
|
||||
* and others. This API makes no assumption about what promise libary is being used which
|
||||
* enables reusing existing code without migrating to a specific promise implementation. Still,
|
||||
* we recommand the use of native promises which are available in VS Code.
|
||||
*/
|
||||
interface Thenable<T> {
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<TResult>): Thenable<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => void): Thenable<TResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the completion of an asynchronous operation
|
||||
*/
|
||||
interface Promise<T> extends Thenable<T> {
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<TResult>): Promise<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => void): Promise<TResult>;
|
||||
|
||||
/**
|
||||
* Attaches a callback for only the rejection of the Promise.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of the callback.
|
||||
*/
|
||||
catch(onrejected?: (reason: any) => T | Thenable<T>): Promise<T>;
|
||||
}
|
||||
|
||||
interface PromiseConstructor {
|
||||
/**
|
||||
* Creates a new Promise.
|
||||
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
|
||||
* a resolve callback used resolve the promise with a value or the result of another promise,
|
||||
* and a reject callback used to reject the promise with a provided reason or error.
|
||||
*/
|
||||
new <T>(executor: (resolve: (value?: T | Thenable<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T>(values: Array<T | Thenable<T>>): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T>(values: Array<T | Thenable<T>>): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a new rejected promise for the provided reason.
|
||||
* @param reason The reason the promise was rejected.
|
||||
* @returns A new rejected Promise.
|
||||
*/
|
||||
reject(reason: any): Promise<void>;
|
||||
|
||||
/**
|
||||
* Creates a new rejected promise for the provided reason.
|
||||
* @param reason The reason the promise was rejected.
|
||||
* @returns A new rejected Promise.
|
||||
*/
|
||||
reject<T>(reason: any): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a new resolved promise for the provided value.
|
||||
* @param value A promise.
|
||||
* @returns A promise whose internal state matches the provided promise.
|
||||
*/
|
||||
resolve<T>(value: T | Thenable<T>): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a new resolved promise .
|
||||
* @returns A resolved promise.
|
||||
*/
|
||||
resolve(): Promise<void>;
|
||||
}
|
||||
|
||||
declare var Promise: PromiseConstructor;
|
8
extensions/html/server/src/typings/ref.d.ts
vendored
8
extensions/html/server/src/typings/ref.d.ts
vendored
|
@ -1,8 +0,0 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
/// <reference path='../../../../../src/typings/mocha.d.ts'/>
|
||||
/// <reference path='../../../../../extensions/node.d.ts'/>
|
||||
/// <reference path='../../../../../extensions/lib.core.d.ts'/>
|
||||
/// <reference path='../../../../../extensions/declares.d.ts'/>
|
|
@ -1,11 +1,10 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"noLib": true,
|
||||
"target": "es5",
|
||||
"module": "commonjs",
|
||||
"outDir": "./out"
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
"outDir": "./out",
|
||||
"lib": [
|
||||
"es5", "es2015.promise"
|
||||
]
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue