diff --git a/packages/language-service/src/ts_plugin.ts b/packages/language-service/src/ts_plugin.ts index e88d9941c1..b7336d9bbd 100644 --- a/packages/language-service/src/ts_plugin.ts +++ b/packages/language-service/src/ts_plugin.ts @@ -21,76 +21,11 @@ export function getExternalFiles(project: any): string[]|undefined { } } -const angularOnlyResults = process.argv.indexOf('--angularOnlyResults') >= 0; - -function angularOnlyFilter(ls: ts.LanguageService): ts.LanguageService { - return { - cleanupSemanticCache: () => ls.cleanupSemanticCache(), - getSyntacticDiagnostics: fileName => [], - getSemanticDiagnostics: fileName => [], - getCompilerOptionsDiagnostics: () => [], - getSyntacticClassifications: (fileName, span) => [], - getSemanticClassifications: (fileName, span) => [], - getEncodedSyntacticClassifications: (fileName, span) => {undefined}, - getEncodedSemanticClassifications: (fileName, span) => undefined, - getCompletionsAtPosition: (fileName, position) => undefined, - getCompletionEntryDetails: (fileName, position, entryName) => - undefined, - getCompletionEntrySymbol: (fileName, position, entryName) => undefined, - getQuickInfoAtPosition: (fileName, position) => undefined, - getNameOrDottedNameSpan: (fileName, startPos, endPos) => undefined, - getBreakpointStatementAtPosition: (fileName, position) => undefined, - getSignatureHelpItems: (fileName, position) => undefined, - getRenameInfo: (fileName, position) => undefined, - findRenameLocations: (fileName, position, findInStrings, findInComments) => - [], - getDefinitionAtPosition: (fileName, position) => [], - getTypeDefinitionAtPosition: (fileName, position) => [], - getImplementationAtPosition: (fileName, position) => [], - getReferencesAtPosition: (fileName: string, position: number) => [], - findReferences: (fileName: string, position: number) => [], - getDocumentHighlights: (fileName, position, filesToSearch) => [], - /** @deprecated */ - getOccurrencesAtPosition: (fileName, position) => [], - getNavigateToItems: searchValue => [], - getNavigationBarItems: fileName => [], - getNavigationTree: fileName => undefined, - getOutliningSpans: fileName => [], - getTodoComments: (fileName, descriptors) => [], - getBraceMatchingAtPosition: (fileName, position) => [], - getIndentationAtPosition: (fileName, position, options) => undefined, - getFormattingEditsForRange: (fileName, start, end, options) => [], - getFormattingEditsForDocument: (fileName, options) => [], - getFormattingEditsAfterKeystroke: (fileName, position, key, options) => [], - getDocCommentTemplateAtPosition: (fileName, position) => undefined, - isValidBraceCompletionAtPosition: (fileName, position, openingBrace) => undefined, - getSpanOfEnclosingComment: (fileName, position, onlyMultiLine) => undefined, - getCodeFixesAtPosition: (fileName, start, end, errorCodes) => [], - applyCodeActionCommand: (action: any) => Promise.resolve(undefined), - getEmitOutput: fileName => undefined, - getProgram: () => ls.getProgram(), - dispose: () => ls.dispose(), - getApplicableRefactors: (fileName, positionOrRaneg) => [], - getEditsForRefactor: (fileName, formatOptions, positionOrRange, refactorName, actionName) => - undefined, - getDefinitionAndBoundSpan: (fileName: string, position: number): - ts.DefinitionInfoAndBoundSpan => - ({definitions: [], textSpan: {start: 0, length: 0}}), - getCombinedCodeFix: - (scope: ts.CombinedCodeFixScope, fixId: {}, formatOptions: ts.FormatCodeSettings): - ts.CombinedCodeActions => ({changes: [], commands: undefined}) - }; -} - export function create(info: any /* ts.server.PluginCreateInfo */): ts.LanguageService { // Create the proxy const proxy: ts.LanguageService = Object.create(null); let oldLS: ts.LanguageService = info.languageService; - if (angularOnlyResults) { - oldLS = angularOnlyFilter(oldLS); - } - function tryCall(fileName: string | undefined, callback: () => T): T { if (fileName && !oldLS.getProgram().getSourceFile(fileName)) { return undefined as any as T;