-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: LS: Refactoringse.g. extract to constant or function, rename symbole.g. extract to constant or function, rename symbol
Milestone
Description
TypeScript Version: 4.0.0-dev.20200526
Search Terms: RangeFacts.HasReturn
Try to extract these lines to a function in createLanguageService:
TypeScript/src/services/services.ts
Lines 1268 to 1308 in 3bb84ef
| // Now create a new compiler | |
| const compilerHost: CompilerHost = { | |
| getSourceFile: getOrCreateSourceFile, | |
| getSourceFileByPath: getOrCreateSourceFileByPath, | |
| getCancellationToken: () => cancellationToken, | |
| getCanonicalFileName, | |
| useCaseSensitiveFileNames: () => useCaseSensitiveFileNames, | |
| getNewLine: () => getNewLineCharacter(newSettings, () => getNewLineOrDefaultFromHost(host)), | |
| getDefaultLibFileName: (options) => host.getDefaultLibFileName(options), | |
| writeFile: noop, | |
| getCurrentDirectory: () => currentDirectory, | |
| fileExists, | |
| readFile, | |
| realpath: host.realpath && (path => host.realpath!(path)), | |
| directoryExists: directoryName => { | |
| return directoryProbablyExists(directoryName, host); | |
| }, | |
| getDirectories: path => { | |
| return host.getDirectories ? host.getDirectories(path) : []; | |
| }, | |
| readDirectory(path, extensions, exclude, include, depth) { | |
| Debug.checkDefined(host.readDirectory, "'LanguageServiceHost.readDirectory' must be implemented to correctly process 'projectReferences'"); | |
| return host.readDirectory!(path, extensions, exclude, include, depth); | |
| }, | |
| onReleaseOldSourceFile, | |
| hasInvalidatedResolution, | |
| hasChangedAutomaticTypeDirectiveNames: host.hasChangedAutomaticTypeDirectiveNames | |
| }; | |
| if (host.trace) { | |
| compilerHost.trace = message => host.trace!(message); | |
| } | |
| if (host.resolveModuleNames) { | |
| compilerHost.resolveModuleNames = (...args) => host.resolveModuleNames!(...args); | |
| } | |
| if (host.resolveTypeReferenceDirectives) { | |
| compilerHost.resolveTypeReferenceDirectives = (...args) => host.resolveTypeReferenceDirectives!(...args); | |
| } | |
| if (host.useSourceOfProjectReferenceRedirect) { | |
| compilerHost.useSourceOfProjectReferenceRedirect = () => host.useSourceOfProjectReferenceRedirect!(); | |
| } |
Error stack:
Error: Debug Failure. False expression: Expected RangeFacts.HasReturn flag to be unset
at extractFunctionInScope (/Users/andrew/.vscode-insiders/extensions/ms-vscode.vscode-typescript-next-4.0.20200526/node_modules/typescript/lib/tsserver.js:136020:30)
at getFunctionExtractionAtIndex (/Users/andrew/.vscode-insiders/extensions/ms-vscode.vscode-typescript-next-4.0.20200526/node_modules/typescript/lib/tsserver.js:135807:24)
at Object.getEditsForAction (/Users/andrew/.vscode-insiders/extensions/ms-vscode.vscode-typescript-next-4.0.20200526/node_modules/typescript/lib/tsserver.js:135401:28)
at Object.getEditsForRefactor (/Users/andrew/.vscode-insiders/extensions/ms-vscode.vscode-typescript-next-4.0.20200526/node_modules/typescript/lib/tsserver.js:128047:41)
at Object.getEditsForRefactor (/Users/andrew/.vscode-insiders/extensions/ms-vscod...
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: LS: Refactoringse.g. extract to constant or function, rename symbole.g. extract to constant or function, rename symbol