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

Support Typescript 3.0 #500

Merged
merged 1 commit into from
Sep 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"rxjs": "^5.5.0",
"semaphore-async-await": "^1.5.1",
"string-similarity": "^1.1.0",
"typescript": "2.8.3",
"typescript": "3.0.1",
"vscode-jsonrpc": "^3.3.1",
"vscode-languageserver": "^4.2.1",
"vscode-languageserver-types": "^3.0.3"
Expand Down Expand Up @@ -82,8 +82,8 @@
"sinon": "^5.0.0",
"source-map-support": "^0.5.0",
"temp": "^0.8.3",
"tslint": "^5.8.0",
"tslint-language-service": "^0.9.6",
"tslint": "^5.11.0",
"tslint-language-service": "^0.9.9",
"validate-commit-msg": "^2.12.2"
},
"bin": {
Expand Down
21 changes: 5 additions & 16 deletions src/test/typescript-service-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2325,18 +2325,7 @@ export function describeTypeScriptService(
' readonly COMMENT_NODE: number;',
' readonly DOCUMENT_FRAGMENT_NODE: number;',
' readonly DOCUMENT_NODE: number;',
' readonly DOCUMENT_POSITION_CONTAINED_BY: number;',
' readonly DOCUMENT_POSITION_CONTAINS: number;',
' readonly DOCUMENT_POSITION_DISCONNECTED: number;',
' readonly DOCUMENT_POSITION_FOLLOWING: number;',
' readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number;',
' readonly DOCUMENT_POSITION_PRECEDING: number;',
' readonly DOCUMENT_TYPE_NODE: number;',
' readonly ELEMENT_NODE: number;',
' readonly ENTITY_NODE: number;',
' readonly ENTITY_REFERENCE_NODE: number;',
' readonly NOTATION_NODE: number;',
' readonly PROCESSING_INSTRUCTION_NODE: number;',
' ... 12 more ...;',
' readonly TEXT_NODE: number;',
'}',
].join('\n'),
Expand Down Expand Up @@ -2367,11 +2356,11 @@ export function describeTypeScriptService(
uri: 'git://github.com/Microsoft/TypeScript?v' + ts.version + '#lib/lib.dom.d.ts',
range: {
start: {
line: 9378,
line: 10275,
character: 10,
},
end: {
line: 9378,
line: 10275,
character: 14,
},
},
Expand All @@ -2380,11 +2369,11 @@ export function describeTypeScriptService(
uri: 'git://github.com/Microsoft/TypeScript?v' + ts.version + '#lib/lib.dom.d.ts',
range: {
start: {
line: 9429,
line: 10326,
character: 12,
},
end: {
line: 9429,
line: 10326,
character: 16,
},
},
Expand Down
21 changes: 11 additions & 10 deletions src/typescript-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,7 @@ export class TypeScriptService {

const details = configuration
.getService()
.getCompletionEntryDetails(fileName, offset, entryName, undefined, undefined)
.getCompletionEntryDetails(fileName, offset, entryName, undefined, undefined, undefined)

if (details) {
item.documentation = ts.displayPartsToString(details.documentation)
Expand Down Expand Up @@ -1307,9 +1307,9 @@ export class TypeScriptService {
params.position.character
)

const signatures: ts.SignatureHelpItems = configuration
const signatures: ts.SignatureHelpItems | undefined = configuration
.getService()
.getSignatureHelpItems(filePath, offset)
.getSignatureHelpItems(filePath, offset, undefined)
if (!signatures) {
return { signatures: [], activeParameter: 0, activeSignature: 0 }
}
Expand Down Expand Up @@ -1382,7 +1382,7 @@ export class TypeScriptService {
return (
configuration
.getService()
.getCodeFixesAtPosition(filePath, start, end, errorCodes, this.settings.format || {}) || []
.getCodeFixesAtPosition(filePath, start, end, errorCodes, this.settings.format || {}, {}) || []
)
})
.map((action: ts.CodeAction): Operation => ({
Expand Down Expand Up @@ -1496,7 +1496,7 @@ export class TypeScriptService {
}

return Observable.from(
configuration.getService().findRenameLocations(filePath, position, false, true)
configuration.getService().findRenameLocations(filePath, position, false, true) || []
).map((location: ts.RenameLocation): [string, TextEdit] => {
const sourceFile = this._getSourceFile(configuration, location.fileName, span)
if (!sourceFile) {
Expand Down Expand Up @@ -1585,12 +1585,13 @@ export class TypeScriptService {
const tsDiagnostics = config
.getService()
.getSyntacticDiagnostics(fileName)
.concat(config.getService().getSemanticDiagnostics(fileName))
.concat(
config
.getService()
.getSemanticDiagnostics(fileName)
.filter((e): e is ts.DiagnosticWithLocation => !!e.file)
)
const diagnostics = iterate(tsDiagnostics)
// TS can report diagnostics without a file and range in some cases
// These cannot be represented as LSP Diagnostics since the range and URI is required
// https://github.com/Microsoft/TypeScript/issues/15666
.filter(diagnostic => !!diagnostic.file)
.map(convertTsDiagnostic)
.toArray()
this.client.textDocumentPublishDiagnostics({ uri, diagnostics })
Expand Down