提交 87ae03d9 编写于 作者: M Martin Aeschlimann

[json] update dependencies & adopt

上级 fa8a9424
......@@ -14,7 +14,7 @@ import * as nls from 'vscode-nls';
let localize = nls.loadMessageBundle();
namespace VSCodeContentRequest {
export const type: RequestType<string, string, any, any> = { get method() { return 'vscode/content'; }, _: null };
export const type: RequestType<string, string, any, any> = new RequestType('vscode/content');
}
export interface ISchemaAssociations {
......@@ -22,7 +22,7 @@ export interface ISchemaAssociations {
}
namespace SchemaAssociationNotification {
export const type: NotificationType<ISchemaAssociations, any> = { get method() { return 'json/schemaAssociations'; }, _: null };
export const type: NotificationType<ISchemaAssociations, any> = new NotificationType('json/schemaAssociations');
}
interface IPackageInfo {
......
......@@ -13,24 +13,24 @@
"resolved": "https://registry.npmjs.org/vscode-extension-telemetry/-/vscode-extension-telemetry-0.0.5.tgz"
},
"vscode-jsonrpc": {
"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"
"version": "3.0.2-beta.5",
"from": "vscode-jsonrpc@>=3.0.2-beta.5 <4.0.0",
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-3.0.2-beta.5.tgz"
},
"vscode-languageclient": {
"version": "3.0.1-alpha.3",
"version": "3.0.2-beta.5",
"from": "vscode-languageclient@next",
"resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-3.0.1-alpha.3.tgz"
"resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-3.0.2-beta.5.tgz"
},
"vscode-languageserver-types": {
"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"
"version": "3.0.2-beta.5",
"from": "vscode-languageserver-types@>=3.0.2-beta.5 <4.0.0",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.0.2-beta.5.tgz"
},
"vscode-nls": {
"version": "1.0.7",
"from": "vscode-nls@latest",
"resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-1.0.7.tgz"
"version": "2.0.2",
"from": "vscode-nls@>=2.0.2 <3.0.0",
"resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-2.0.2.tgz"
},
"winreg": {
"version": "0.0.13",
......
......@@ -113,8 +113,8 @@
},
"dependencies": {
"vscode-extension-telemetry": "^0.0.5",
"vscode-languageclient": "3.0.1-alpha.3",
"vscode-nls": "^1.0.7"
"vscode-languageclient": "^3.0.2-beta.5",
"vscode-nls": "^2.0.2"
},
"devDependencies": {
"@types/node": "^6.0.51"
......
......@@ -8,9 +8,9 @@
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-1.0.2.tgz"
},
"debug": {
"version": "2.2.0",
"version": "2.6.0",
"from": "debug@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz"
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.0.tgz"
},
"extend": {
"version": "3.0.0",
......@@ -28,44 +28,42 @@
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-0.3.6.tgz"
},
"jsonc-parser": {
"version": "0.2.3",
"from": "jsonc-parser@>=0.2.3 <0.3.0",
"resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-0.2.3.tgz"
"version": "0.3.0",
"from": "jsonc-parser@latest"
},
"ms": {
"version": "0.7.1",
"from": "ms@0.7.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz"
"version": "0.7.2",
"from": "ms@0.7.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz"
},
"request-light": {
"version": "0.1.0",
"from": "request-light@>=0.1.0 <0.2.0",
"resolved": "https://registry.npmjs.org/request-light/-/request-light-0.1.0.tgz"
"version": "0.2.0",
"from": "request-light@>=0.2.0 <0.3.0"
},
"vscode-json-languageservice": {
"version": "2.0.0-next.9",
"version": "2.0.0-next.12",
"from": "vscode-json-languageservice@next",
"resolved": "https://registry.npmjs.org/vscode-json-languageservice/-/vscode-json-languageservice-2.0.0-next.9.tgz"
"resolved": "https://registry.npmjs.org/vscode-json-languageservice/-/vscode-json-languageservice-2.0.0-next.12.tgz"
},
"vscode-jsonrpc": {
"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"
"version": "3.0.2-beta.5",
"from": "vscode-jsonrpc@>=3.0.2-beta.5 <4.0.0",
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-3.0.2-beta.5.tgz"
},
"vscode-languageserver": {
"version": "3.0.1-alpha.3",
"version": "3.0.2-beta.5",
"from": "vscode-languageserver@next",
"resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-3.0.1-alpha.3.tgz"
"resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-3.0.2-beta.5.tgz"
},
"vscode-languageserver-types": {
"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"
"version": "3.0.2-beta.5",
"from": "vscode-languageserver-types@>=3.0.2-beta.5 <4.0.0",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.0.2-beta.5.tgz"
},
"vscode-nls": {
"version": "1.0.7",
"from": "vscode-nls@>=1.0.4 <2.0.0",
"resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-1.0.7.tgz"
"version": "2.0.2",
"from": "vscode-nls@>=2.0.2 <3.0.0",
"resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-2.0.2.tgz"
},
"vscode-uri": {
"version": "1.0.0",
......
......@@ -8,10 +8,11 @@
"node": "*"
},
"dependencies": {
"request-light": "^0.1.0",
"vscode-json-languageservice": "^2.0.0-next.9",
"vscode-languageserver": "3.0.1-alpha.3",
"vscode-nls": "^1.0.7"
"jsonc-parser": "^0.3.0",
"request-light": "^0.2.0",
"vscode-json-languageservice": "^2.0.0-next.12",
"vscode-languageserver": "^3.0.2-beta.5",
"vscode-nls": "^2.0.2"
},
"devDependencies": {
"@types/node": "^6.0.51"
......
......@@ -29,11 +29,11 @@ interface ISchemaAssociations {
}
namespace SchemaAssociationNotification {
export const type: NotificationType<ISchemaAssociations, any> = { get method() { return 'json/schemaAssociations'; }, _: null };
export const type: NotificationType<ISchemaAssociations, any> = new NotificationType('json/schemaAssociations');
}
namespace VSCodeContentRequest {
export const type: RequestType<string, string, any, any> = { get method() { return 'vscode/content'; }, _: null };
export const type: RequestType<string, string, any, any> = new RequestType('vscode/content');
}
// Create a connection for the server
......
......@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import { MarkedString, CompletionItemKind, CompletionItem, SnippetString } from 'vscode-languageserver';
import { MarkedString, CompletionItemKind, CompletionItem, InsertTextFormat } from 'vscode-languageserver';
import Strings = require('../utils/strings');
import { JSONWorkerContribution, JSONPath, CompletionsCollector } from 'vscode-json-languageservice';
......@@ -12,8 +12,8 @@ import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
let globProperties: CompletionItem[] = [
{ kind: CompletionItemKind.Value, label: localize('assocLabelFile', "Files with Extension"), insertText: SnippetString.create('"*.${1:extension}": "${2:language}"'), documentation: localize('assocDescriptionFile', "Map all files matching the glob pattern in their filename to the language with the given identifier.") },
{ kind: CompletionItemKind.Value, label: localize('assocLabelPath', "Files with Path"), insertText: SnippetString.create('"/${1:path to file}/*.${2:extension}": "${3:language}"'), documentation: localize('assocDescriptionPath', "Map all files matching the absolute path glob pattern in their path to the language with the given identifier.") }
{ kind: CompletionItemKind.Value, label: localize('assocLabelFile', "Files with Extension"), insertText: '"*.${1:extension}": "${2:language}"', insertTextFormat: InsertTextFormat.Snippet, documentation: localize('assocDescriptionFile', "Map all files matching the glob pattern in their filename to the language with the given identifier.") },
{ kind: CompletionItemKind.Value, label: localize('assocLabelPath', "Files with Path"), insertText: '"/${1:path to file}/*.${2:extension}": "${3:language}"', insertTextFormat: InsertTextFormat.Snippet, documentation: localize('assocDescriptionPath', "Map all files matching the absolute path glob pattern in their path to the language with the given identifier.") }
];
export class FileAssociationContribution implements JSONWorkerContribution {
......@@ -50,7 +50,8 @@ export class FileAssociationContribution implements JSONWorkerContribution {
result.add({
kind: CompletionItemKind.Value,
label: l,
insertText: SnippetString.create(JSON.stringify('${1:' + l + '}')),
insertText: JSON.stringify('${1:' + l + '}'),
insertTextFormat: InsertTextFormat.Snippet,
filterText: JSON.stringify(l)
});
});
......
......@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import { MarkedString, CompletionItemKind, CompletionItem, SnippetString } from 'vscode-languageserver';
import { MarkedString, CompletionItemKind, CompletionItem, InsertTextFormat } from 'vscode-languageserver';
import Strings = require('../utils/strings');
import { JSONWorkerContribution, JSONPath, CompletionsCollector } from 'vscode-json-languageservice';
......@@ -12,18 +12,18 @@ import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
let globProperties: CompletionItem[] = [
{ kind: CompletionItemKind.Value, label: localize('fileLabel', "Files by Extension"), insertText: SnippetString.create('"**/*.${1:extension}": true'), documentation: localize('fileDescription', "Match all files of a specific file extension.") },
{ kind: CompletionItemKind.Value, label: localize('fileLabel', "Files by Extension"), insertText: '"**/*.${1:extension}": true', insertTextFormat: InsertTextFormat.Snippet, documentation: localize('fileDescription', "Match all files of a specific file extension.") },
{ kind: CompletionItemKind.Value, label: localize('filesLabel', "Files with Multiple Extensions"), insertText: '"**/*.{ext1,ext2,ext3}": true', documentation: localize('filesDescription', "Match all files with any of the file extensions.") },
{ kind: CompletionItemKind.Value, label: localize('derivedLabel', "Files with Siblings by Name"), insertText: SnippetString.create('"**/*.${1:source-extension}": { "when": "$(basename).${2:target-extension}" }'), documentation: localize('derivedDescription', "Match files that have siblings with the same name but a different extension.") },
{ kind: CompletionItemKind.Value, label: localize('topFolderLabel', "Folder by Name (Top Level)"), insertText: SnippetString.create('"${1:name}": true'), documentation: localize('topFolderDescription', "Match a top level folder with a specific name.") },
{ kind: CompletionItemKind.Value, label: localize('derivedLabel', "Files with Siblings by Name"), insertText: '"**/*.${1:source-extension}": { "when": "$(basename).${2:target-extension}" }', insertTextFormat: InsertTextFormat.Snippet, documentation: localize('derivedDescription', "Match files that have siblings with the same name but a different extension.") },
{ kind: CompletionItemKind.Value, label: localize('topFolderLabel', "Folder by Name (Top Level)"), insertText: '"${1:name}": true', insertTextFormat: InsertTextFormat.Snippet, documentation: localize('topFolderDescription', "Match a top level folder with a specific name.") },
{ kind: CompletionItemKind.Value, label: localize('topFoldersLabel', "Folders with Multiple Names (Top Level)"), insertText: '"{folder1,folder2,folder3}": true', documentation: localize('topFoldersDescription', "Match multiple top level folders.") },
{ kind: CompletionItemKind.Value, label: localize('folderLabel', "Folder by Name (Any Location)"), insertText: SnippetString.create('"**/${1:name}": true'), documentation: localize('folderDescription', "Match a folder with a specific name in any location.") },
{ kind: CompletionItemKind.Value, label: localize('folderLabel', "Folder by Name (Any Location)"), insertText: '"**/${1:name}": true', insertTextFormat: InsertTextFormat.Snippet, documentation: localize('folderDescription', "Match a folder with a specific name in any location.") },
];
let globValues: CompletionItem[] = [
{ kind: CompletionItemKind.Value, label: localize('trueLabel', "true"), filterText: 'true', insertText: 'true', documentation: localize('trueDescription', "Enable the pattern.") },
{ kind: CompletionItemKind.Value, label: localize('falseLabel', "false"), filterText: 'false', insertText: 'false', documentation: localize('falseDescription', "Disable the pattern.") },
{ kind: CompletionItemKind.Value, label: localize('derivedLabel', "Files with Siblings by Name"), insertText: SnippetString.create('{ "when": "$(basename).${1:extension}" }'), documentation: localize('siblingsDescription', "Match files that have siblings with the same name but a different extension.") }
{ kind: CompletionItemKind.Value, label: localize('derivedLabel', "Files with Siblings by Name"), insertText: '{ "when": "$(basename).${1:extension}" }', insertTextFormat: InsertTextFormat.Snippet, documentation: localize('siblingsDescription', "Match files that have siblings with the same name but a different extension.") }
];
export class GlobPatternContribution implements JSONWorkerContribution {
......
......@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import { MarkedString, CompletionItemKind, CompletionItem, SnippetString } from 'vscode-languageserver';
import { MarkedString, CompletionItemKind, CompletionItem, InsertTextFormat } from 'vscode-languageserver';
import Strings = require('../utils/strings');
import { XHRResponse, getErrorStatusDescription, xhr } from 'request-light';
import { JSONWorkerContribution, JSONPath, CompletionsCollector } from 'vscode-json-languageservice';
......@@ -47,7 +47,7 @@ export class ProjectJSONContribution implements JSONWorkerContribution {
this.cacheSize--;
return false;
}
let insertTextValue = (<SnippetString>item.insertText).value;
let insertTextValue = item.insertText;
item.detail = entry.version;
item.documentation = entry.description;
item.insertText = insertTextValue.replace(/\$1/, '${1:' + entry.version + '}');
......@@ -103,15 +103,15 @@ export class ProjectJSONContribution implements JSONWorkerContribution {
public collectDefaultCompletions(resource: string, result: CompletionsCollector): Thenable<any> {
if (this.isProjectJSONFile(resource)) {
let insertText = SnippetString.create(JSON.stringify({
let insertText = JSON.stringify({
'version': '${1:1.0.0-*}',
'dependencies': {},
'frameworks': {
'net461': {},
'netcoreapp1.0': {}
}
}, null, '\t'));
result.add({ kind: CompletionItemKind.Class, label: localize('json.project.default', 'Default project.json'), insertText, documentation: '' });
}, null, '\t');
result.add({ kind: CompletionItemKind.Class, label: localize('json.project.default', 'Default project.json'), insertText, insertTextFormat: InsertTextFormat.Snippet, documentation: '' });
}
return null;
}
......@@ -155,7 +155,7 @@ export class ProjectJSONContribution implements JSONWorkerContribution {
insertText += ',';
}
}
let item: CompletionItem = { kind: CompletionItemKind.Property, label: name, insertText: SnippetString.create(insertText), filterText: JSON.stringify(name) };
let item: CompletionItem = { kind: CompletionItemKind.Property, label: name, insertText: insertText, insertTextFormat: InsertTextFormat.Snippet, filterText: JSON.stringify(name) };
if (!this.completeWithCache(name, item)) {
item.data = RESOLVE_ID + name;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册