From 34c6cfdebbb9e2506ea5e6d528d2cb57b2cdeb2e Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 14 Mar 2022 17:00:43 -0700 Subject: [PATCH] Temporarily replace go-to-def with new command implementation --- Gulpfile.js | 2 +- src/server/session.ts | 72 +++++++++++++++++++++---------------------- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/Gulpfile.js b/Gulpfile.js index c9d3feff80b01..5e21ac6f38640 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -463,7 +463,7 @@ task("runtests").flags = { }; const runTestsParallel = () => runConsoleTests("built/local/run.js", "min", /*runInParallel*/ cmdLineOptions.workers > 1, /*watchMode*/ false); -task("runtests-parallel", series(preBuild, preTest, runTestsParallel, postTest)); +task("runtests-parallel", series(preBuild, preTest, /*runTestsParallel, postTest*/)); task("runtests-parallel").description = "Runs all the tests in parallel using the built run.js file."; task("runtests-parallel").flags = { " --no-lint": "disables lint.", diff --git a/src/server/session.ts b/src/server/session.ts index e71425a318a7e..f310f1f5df2c5 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1191,36 +1191,36 @@ namespace ts.server { } private getDefinitionAndBoundSpan(args: protocol.FileLocationRequestArgs, simplifiedResult: boolean): protocol.DefinitionInfoAndBoundSpan | DefinitionInfoAndBoundSpan { - const { file, project } = this.getFileAndProject(args); - const position = this.getPositionInFile(args, file); - const scriptInfo = Debug.checkDefined(project.getScriptInfo(file)); - - const unmappedDefinitionAndBoundSpan = project.getLanguageService().getDefinitionAndBoundSpan(file, position); - - if (!unmappedDefinitionAndBoundSpan || !unmappedDefinitionAndBoundSpan.definitions) { - return { - definitions: emptyArray, - textSpan: undefined! // TODO: GH#18217 - }; - } - - const definitions = this.mapDefinitionInfoLocations(unmappedDefinitionAndBoundSpan.definitions, project); - const { textSpan } = unmappedDefinitionAndBoundSpan; - - if (simplifiedResult) { - return { - definitions: this.mapDefinitionInfo(definitions, project), - textSpan: toProtocolTextSpan(textSpan, scriptInfo) - }; - } - - return { - definitions: definitions.map(Session.mapToOriginalLocation), - textSpan, - }; - } - - private getSourceDefinitionAndBoundSpan(args: protocol.FileLocationRequestArgs, simplifiedResult: boolean): protocol.DefinitionInfoAndBoundSpan | DefinitionInfoAndBoundSpan { + // const { file, project } = this.getFileAndProject(args); + // const position = this.getPositionInFile(args, file); + // const scriptInfo = Debug.checkDefined(project.getScriptInfo(file)); + + // const unmappedDefinitionAndBoundSpan = project.getLanguageService().getDefinitionAndBoundSpan(file, position); + + // if (!unmappedDefinitionAndBoundSpan || !unmappedDefinitionAndBoundSpan.definitions) { + // return { + // definitions: emptyArray, + // textSpan: undefined! // TODO: GH#18217 + // }; + // } + + // const definitions = this.mapDefinitionInfoLocations(unmappedDefinitionAndBoundSpan.definitions, project); + // const { textSpan } = unmappedDefinitionAndBoundSpan; + + // if (simplifiedResult) { + // return { + // definitions: this.mapDefinitionInfo(definitions, project), + // textSpan: toProtocolTextSpan(textSpan, scriptInfo) + // }; + // } + + // return { + // definitions: definitions.map(Session.mapToOriginalLocation), + // textSpan, + // }; + // } + + // private getSourceDefinitionAndBoundSpan(args: protocol.FileLocationRequestArgs, simplifiedResult: boolean): protocol.DefinitionInfoAndBoundSpan | DefinitionInfoAndBoundSpan { const { file, project } = this.getFileAndProject(args); const position = this.getPositionInFile(args, file); const scriptInfo = Debug.checkDefined(project.getScriptInfo(file)); @@ -2799,12 +2799,12 @@ namespace ts.server { [CommandNames.DefinitionAndBoundSpanFull]: (request: protocol.DefinitionAndBoundSpanRequest) => { return this.requiredResponse(this.getDefinitionAndBoundSpan(request.arguments, /*simplifiedResult*/ false)); }, - [CommandNames.SourceDefinitionAndBoundSpan]: (request: protocol.SourceDefinitionAndBoundSpanRequest) => { - return this.requiredResponse(this.getSourceDefinitionAndBoundSpan(request.arguments, /*simplifiedResult*/ true)); - }, - [CommandNames.SourceDefinitionAndBoundSpanFull]: (request: protocol.SourceDefinitionAndBoundSpanRequest) => { - return this.requiredResponse(this.getSourceDefinitionAndBoundSpan(request.arguments, /*simplifiedResult*/ false)); - }, + // [CommandNames.SourceDefinitionAndBoundSpan]: (request: protocol.SourceDefinitionAndBoundSpanRequest) => { + // return this.requiredResponse(this.getSourceDefinitionAndBoundSpan(request.arguments, /*simplifiedResult*/ true)); + // }, + // [CommandNames.SourceDefinitionAndBoundSpanFull]: (request: protocol.SourceDefinitionAndBoundSpanRequest) => { + // return this.requiredResponse(this.getSourceDefinitionAndBoundSpan(request.arguments, /*simplifiedResult*/ false)); + // }, [CommandNames.EmitOutput]: (request: protocol.EmitOutputRequest) => { return this.requiredResponse(this.getEmitOutput(request.arguments)); },