Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 2cac6cb

Browse files
daviwilfelixfbecker
authored andcommitted
feat(typescript): upgrade to typescript 2.6.2 (#430)
1 parent 982bf69 commit 2cac6cb

File tree

3 files changed

+32
-29
lines changed

3 files changed

+32
-29
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"rxjs": "^5.5.0",
5252
"semaphore-async-await": "^1.5.1",
5353
"string-similarity": "^1.1.0",
54-
"typescript": "2.4.2",
54+
"typescript": "2.6.2",
5555
"vscode-jsonrpc": "^3.3.1",
5656
"vscode-languageserver": "^3.1.0",
5757
"vscode-languageserver-types": "^3.0.3"

src/test/typescript-service-helpers.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2297,11 +2297,11 @@ export function describeTypeScriptService(
22972297
uri: 'git://github.com/Microsoft/TypeScript?v' + ts.version + '#lib/lib.dom.d.ts',
22982298
range: {
22992299
start: {
2300-
line: 8259,
2300+
line: 8428,
23012301
character: 10,
23022302
},
23032303
end: {
2304-
line: 8259,
2304+
line: 8428,
23052305
character: 14,
23062306
},
23072307
},
@@ -2310,11 +2310,11 @@ export function describeTypeScriptService(
23102310
uri: 'git://github.com/Microsoft/TypeScript?v' + ts.version + '#lib/lib.dom.d.ts',
23112311
range: {
23122312
start: {
2313-
line: 8311,
2313+
line: 8480,
23142314
character: 12,
23152315
},
23162316
end: {
2317-
line: 8311,
2317+
line: 8480,
23182318
character: 16,
23192319
},
23202320
},
@@ -3028,7 +3028,7 @@ export function describeTypeScriptService(
30283028
},
30293029
position: {
30303030
line: 1,
3031-
character: 13,
3031+
character: 12,
30323032
},
30333033
})
30343034
.reduce<Operation, CompletionList>(applyReducer, null as any)
@@ -3039,7 +3039,7 @@ export function describeTypeScriptService(
30393039
{
30403040
data: {
30413041
entryName: 'bar',
3042-
offset: 51,
3042+
offset: 50,
30433043
uri: rootUri + 'uses-reference.ts',
30443044
},
30453045
label: 'bar',

src/typescript-service.ts

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -100,25 +100,25 @@ export interface Settings extends PluginSettings {
100100
/**
101101
* Maps string-based CompletionEntry::kind to enum-based CompletionItemKind
102102
*/
103-
const completionKinds: { [name: string]: CompletionItemKind } = {
104-
class: CompletionItemKind.Class,
105-
constructor: CompletionItemKind.Constructor,
106-
enum: CompletionItemKind.Enum,
107-
field: CompletionItemKind.Field,
108-
file: CompletionItemKind.File,
109-
function: CompletionItemKind.Function,
110-
interface: CompletionItemKind.Interface,
111-
keyword: CompletionItemKind.Keyword,
112-
method: CompletionItemKind.Method,
113-
module: CompletionItemKind.Module,
114-
property: CompletionItemKind.Property,
115-
reference: CompletionItemKind.Reference,
116-
snippet: CompletionItemKind.Snippet,
117-
text: CompletionItemKind.Text,
118-
unit: CompletionItemKind.Unit,
119-
value: CompletionItemKind.Value,
120-
variable: CompletionItemKind.Variable,
121-
}
103+
const completionKinds = new Map<string, CompletionItemKind>([
104+
[`class`, CompletionItemKind.Class],
105+
[`constructor`, CompletionItemKind.Constructor],
106+
[`enum`, CompletionItemKind.Enum],
107+
[`field`, CompletionItemKind.Field],
108+
[`file`, CompletionItemKind.File],
109+
[`function`, CompletionItemKind.Function],
110+
[`interface`, CompletionItemKind.Interface],
111+
[`keyword`, CompletionItemKind.Keyword],
112+
[`method`, CompletionItemKind.Method],
113+
[`module`, CompletionItemKind.Module],
114+
[`property`, CompletionItemKind.Property],
115+
[`reference`, CompletionItemKind.Reference],
116+
[`snippet`, CompletionItemKind.Snippet],
117+
[`text`, CompletionItemKind.Text],
118+
[`unit`, CompletionItemKind.Unit],
119+
[`value`, CompletionItemKind.Value],
120+
[`variable`, CompletionItemKind.Variable],
121+
])
122122

123123
/**
124124
* Handles incoming requests and return responses. There is a one-to-one-to-one
@@ -1182,7 +1182,7 @@ export class TypeScriptService {
11821182
params.position.line,
11831183
params.position.character
11841184
)
1185-
const completions = configuration.getService().getCompletionsAtPosition(fileName, offset)
1185+
const completions = configuration.getService().getCompletionsAtPosition(fileName, offset, undefined)
11861186

11871187
if (!completions) {
11881188
return []
@@ -1192,7 +1192,7 @@ export class TypeScriptService {
11921192
.map(entry => {
11931193
const item: CompletionItem = { label: entry.name }
11941194

1195-
const kind = completionKinds[entry.kind]
1195+
const kind = completionKinds.get(entry.kind)
11961196
if (kind) {
11971197
item.kind = kind
11981198
}
@@ -1233,7 +1233,10 @@ export class TypeScriptService {
12331233
const configuration = this.projectManager.getConfiguration(fileName)
12341234
configuration.ensureBasicFiles(span)
12351235

1236-
const details = configuration.getService().getCompletionEntryDetails(fileName, offset, entryName)
1236+
const details = configuration
1237+
.getService()
1238+
.getCompletionEntryDetails(fileName, offset, entryName, undefined, undefined)
1239+
12371240
if (details) {
12381241
item.documentation = ts.displayPartsToString(details.documentation)
12391242
item.detail = ts.displayPartsToString(details.displayParts)

0 commit comments

Comments
 (0)