vscode-languageclient
Advanced tools
Comparing version 6.1.2 to 6.1.3
import * as code from 'vscode'; | ||
import * as proto from 'vscode-languageserver-protocol'; | ||
declare module 'vscode' { | ||
interface Diagnostic { | ||
code2?: { | ||
value: string | number; | ||
target: Uri; | ||
}; | ||
} | ||
} | ||
export interface Converter { | ||
@@ -12,0 +4,0 @@ asUri(uri: code.Uri): string; |
@@ -13,10 +13,2 @@ /* -------------------------------------------------------------------------------------------- | ||
const protocolDocumentLink_1 = require("./protocolDocumentLink"); | ||
var InsertReplaceRange; | ||
(function (InsertReplaceRange) { | ||
function is(value) { | ||
const candidate = value; | ||
return candidate && !!candidate.inserting && !!candidate.replacing; | ||
} | ||
InsertReplaceRange.is = is; | ||
})(InsertReplaceRange || (InsertReplaceRange = {})); | ||
function createConverter(uriConverter) { | ||
@@ -219,2 +211,6 @@ const nullConverter = (value) => value.toString(); | ||
} | ||
function isInsertReplace(value) { | ||
const candidate = value; | ||
return candidate && !!candidate.inserting && !!candidate.replacing; | ||
} | ||
function asRange(value) { | ||
@@ -224,2 +220,6 @@ if (value === undefined || value === null) { | ||
} | ||
// The LSP has no support yet for insert replace. So this can never happen. | ||
if (isInsertReplace(value)) { | ||
throw new Error(`Receving unknown insert replace range.`); | ||
} | ||
return { start: asPosition(value.start), end: asPosition(value.end) }; | ||
@@ -277,11 +277,2 @@ } | ||
} | ||
function asDiagnosticCode(value) { | ||
if (value === undefined || value === null) { | ||
return undefined; | ||
} | ||
if (Is.number(value) || Is.string(value)) { | ||
return value; | ||
} | ||
return { value: value.value, target: asUri(value.target) }; | ||
} | ||
function asDiagnostic(item) { | ||
@@ -292,8 +283,8 @@ let result = proto.Diagnostic.create(asRange(item.range), item.message); | ||
} | ||
result.code = asDiagnosticCode(item.code2 || item.code); | ||
{ | ||
if (Array.isArray(item.tags)) { | ||
result.tags = asDiagnosticTags(item.tags); | ||
} | ||
if (Is.number(item.code) || Is.string(item.code)) { | ||
result.code = item.code; | ||
} | ||
if (Array.isArray(item.tags)) { | ||
result.tags = asDiagnosticTags(item.tags); | ||
} | ||
if (item.relatedInformation) { | ||
@@ -415,3 +406,3 @@ result.relatedInformation = asRelatedInformations(item.relatedInformation); | ||
text = source.textEdit.newText; | ||
range = source.textEdit.range; | ||
range = asRange(source.textEdit.range); | ||
} | ||
@@ -426,7 +417,7 @@ else if (source.insertText instanceof code.SnippetString) { | ||
if (source.range) { | ||
range = source.range; | ||
range = asRange(source.range); | ||
} | ||
target.insertTextFormat = format; | ||
if (source.fromEdit && text !== undefined && range !== undefined) { | ||
target.textEdit = asCompletionTextEdit(text, range); | ||
target.textEdit = { newText: text, range: range }; | ||
} | ||
@@ -437,10 +428,2 @@ else { | ||
} | ||
function asCompletionTextEdit(newText, range) { | ||
if (InsertReplaceRange.is(range)) { | ||
return proto.InsertReplaceEdit.create(newText, asRange(range.inserting), asRange(range.replacing)); | ||
} | ||
else { | ||
return { newText, range: asRange(range) }; | ||
} | ||
} | ||
function asTextEdit(edit) { | ||
@@ -447,0 +430,0 @@ return { range: asRange(edit.range), newText: edit.newText }; |
@@ -30,3 +30,3 @@ /* -------------------------------------------------------------------------------------------- | ||
__export(require("./client")); | ||
const REQUIRED_VSCODE_VERSION = '^1.42.0'; // do not change format, updated by `updateVSCode` script | ||
const REQUIRED_VSCODE_VERSION = '^1.41.0'; // do not change format, updated by `updateVSCode` script | ||
var Executable; | ||
@@ -33,0 +33,0 @@ (function (Executable) { |
@@ -58,3 +58,3 @@ import * as code from 'vscode'; | ||
asSymbolKind(item: ls.SymbolKind): code.SymbolKind; | ||
asSymbolTag(item: ls.SymbolTag): code.SymbolTag | undefined; | ||
asSymbolTag(item: ls.SymbolTag): code.SymbolTag; | ||
asSymbolTags(items: undefined | null): undefined; | ||
@@ -121,10 +121,2 @@ asSymbolTags(items: ReadonlyArray<ls.SymbolTag>): code.SymbolTag[]; | ||
} | ||
declare module 'vscode' { | ||
interface Diagnostic { | ||
code2?: { | ||
value: string | number; | ||
target: Uri; | ||
}; | ||
} | ||
} | ||
export declare function createConverter(uriConverter?: URIConverter): Converter; |
@@ -35,5 +35,2 @@ /* -------------------------------------------------------------------------------------------- | ||
} | ||
if (ls.DiagnosticCode.is(diagnostic.code)) { | ||
result.code2 = { value: diagnostic.code.value, target: asUri(diagnostic.code.target) }; | ||
} | ||
if (diagnostic.source) { | ||
@@ -265,6 +262,6 @@ result.source = diagnostic.source; | ||
if (item.insertTextFormat === ls.InsertTextFormat.Snippet) { | ||
return { text: new code.SnippetString(item.textEdit.newText), range: asCompletionRange(item.textEdit), fromEdit: true }; | ||
return { text: new code.SnippetString(item.textEdit.newText), range: asRange(item.textEdit.range), fromEdit: true }; | ||
} | ||
else { | ||
return { text: item.textEdit.newText, range: asCompletionRange(item.textEdit), fromEdit: true }; | ||
return { text: item.textEdit.newText, range: asRange(item.textEdit.range), fromEdit: true }; | ||
} | ||
@@ -284,10 +281,2 @@ } | ||
} | ||
function asCompletionRange(value) { | ||
if (ls.InsertReplaceEdit.is(value)) { | ||
return { inserting: asRange(value.insert), replacing: asRange(value.replace) }; | ||
} | ||
else { | ||
return asRange(value.range); | ||
} | ||
} | ||
function asTextEdit(edit) { | ||
@@ -453,8 +442,3 @@ if (!edit) { | ||
function asSymbolTag(value) { | ||
switch (value) { | ||
case ls.SymbolTag.Deprecated: | ||
return code.SymbolTag.Deprecated; | ||
default: | ||
return undefined; | ||
} | ||
return value; | ||
} | ||
@@ -465,10 +449,3 @@ function asSymbolTags(items) { | ||
} | ||
const result = []; | ||
for (const item of items) { | ||
const converted = asSymbolTag(item); | ||
if (converted !== undefined) { | ||
result.push(converted); | ||
} | ||
} | ||
return result.length === 0 ? undefined : result; | ||
return items.map(asSymbolTag); | ||
} | ||
@@ -478,3 +455,2 @@ function asSymbolInformation(item, uri) { | ||
let result = new code.SymbolInformation(item.name, asSymbolKind(item.kind), asRange(item.location.range), item.location.uri ? _uriConverter(item.location.uri) : uri); | ||
fillTags(result, item); | ||
if (item.containerName) { | ||
@@ -493,3 +469,2 @@ result.containerName = item.containerName; | ||
let result = new code.DocumentSymbol(value.name, value.detail || '', asSymbolKind(value.kind), asRange(value.range), asRange(value.selectionRange)); | ||
fillTags(result, value); | ||
if (value.children !== undefined && value.children.length > 0) { | ||
@@ -504,15 +479,2 @@ let children = []; | ||
} | ||
function fillTags(result, value) { | ||
result.tags = asSymbolTags(value.tags); | ||
if (value.deprecated) { | ||
if (!result.tags) { | ||
result.tags = [code.SymbolTag.Deprecated]; | ||
} | ||
else { | ||
if (!result.tags.includes(code.SymbolTag.Deprecated)) { | ||
result.tags = result.tags.concat(code.SymbolTag.Deprecated); | ||
} | ||
} | ||
} | ||
} | ||
function asCommand(item) { | ||
@@ -519,0 +481,0 @@ let result = { title: item.title, command: item.command }; |
@@ -76,2 +76,3 @@ /* -------------------------------------------------------------------------------------------- | ||
vscode_languageserver_protocol_1.Proposed.SemanticTokenModifiers.deprecated, | ||
vscode_languageserver_protocol_1.Proposed.SemanticTokenModifiers.async, | ||
vscode_languageserver_protocol_1.Proposed.SemanticTokenModifiers.readonly | ||
@@ -102,3 +103,3 @@ ]; | ||
client.logFailedRequest(vscode_languageserver_protocol_1.Proposed.SemanticTokensRequest.type, error); | ||
throw error; | ||
return undefined; | ||
}); | ||
@@ -128,3 +129,3 @@ }; | ||
client.logFailedRequest(vscode_languageserver_protocol_1.Proposed.SemanticTokensEditsRequest.type, error); | ||
throw error; | ||
return undefined; | ||
}); | ||
@@ -153,3 +154,3 @@ }; | ||
client.logFailedRequest(vscode_languageserver_protocol_1.Proposed.SemanticTokensRangeRequest.type, error); | ||
throw error; | ||
return undefined; | ||
}); | ||
@@ -156,0 +157,0 @@ }; |
{ | ||
"name": "vscode-languageclient", | ||
"description": "VSCode Language client implementation", | ||
"version": "6.1.2", | ||
"version": "6.1.3", | ||
"author": "Microsoft Corporation", | ||
"license": "MIT", | ||
"engines": { | ||
"vscode": "^1.42.0" | ||
"vscode": "^1.41.0" | ||
}, | ||
@@ -22,3 +22,3 @@ "repository": { | ||
"@types/semver": "^6.0.1", | ||
"@types/vscode": "^1.42.0", | ||
"@types/vscode": "1.41.0", | ||
"shx": "^0.3.2" | ||
@@ -31,3 +31,3 @@ }, | ||
"scripts": { | ||
"prepublishOnly": "npm run clean && node ./bin/updateVSCode.js && npm run compile && npm test", | ||
"prepublishOnly": "npm run clean && node ./bin/updateVSCode.js && npm run compile", | ||
"postpublish": "node ../build/npm/post-publish.js", | ||
@@ -34,0 +34,0 @@ "compile": "node ../build/bin/tsc -b ./tsconfig.json && shx cp src/utils/terminateProcess.sh lib/utils/terminateProcess.sh", |
Sorry, the diff of this file is too big to display
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
0
334996
6878