-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Organize Imports: Debug Failure. Did not expect InterfaceDeclaration to have an Identifier in its trivia #22924
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Not an organize-imports bug, but a tsserver bug. Found a simpler repro:
import a from 'a/aaaaaaa/aaaaaaa/aaaaaa/aaaaaaa';
import b from 'b';
import c from 'c';
/** @internal */
export class LanguageIdentifier {}
|
tsserver log:
|
Note that everything works fine up until the |
Looking into the log to see whats going on. |
I modified the debug message to print the file:
including trivia:
source code: function printNode(sf: SourceFile): string {
let out = "";
recur(sf, "");
return out;
function recur(node: Node, indent: string): void {
Debug.assert(node.end <= sf.end);
const text = sf.text.slice(node.pos, node.end);
out += `${indent}${Debug.showSyntaxKind(node)} ${JSON.stringify({ pos: node.pos, end: node.end, text })}\n`;
node.forEachChild(child => recur(child, indent + " "));
}
} |
Probably the jsdoc is not getting considered so we end up rescanning it and encountering an identifier. |
The issue is that JSDoc node doesnt have updated the positions after the incremental parsing: |
From microsoft/vscode#46698
TypeScript Version: 2.9.0-dev.20180327
Search Terms:
Code
modes.ts
: https://github.com/Microsoft/vscode/blob/master/src/vs/editor/common/modes.ts{ IMarkerData }
importBug:
Debug failure:
Also occurs on
references
The text was updated successfully, but these errors were encountered: