-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Skip past module.exports = { Foo }
in go-to-defintion on 'Foo'
#40835
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question about a fail case, but I think it was pre-existing.
while (symbol) { | ||
if (symbol.flags & SymbolFlags.Alias && shouldSkipAlias(node, symbol.declarations[0])) { | ||
const aliased = checker.getAliasedSymbol(symbol); | ||
if (!aliased.declarations) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when does this happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just the converse of the previous code, but I think it could happen in certain error cases where the checker falls back to unknownSymbol
. Not sure if that’s actually possible in getAliasedSymbol
, but I feel like our assumption that symbols always have declarations is a frequent source of crashes, particularly in error-ridden code.
@@ -777,7 +788,7 @@ namespace FourSlash { | |||
const fileContent = this.getFileContent(startFile); | |||
const spanContent = fileContent.slice(defs.textSpan.start, ts.textSpanEnd(defs.textSpan)); | |||
const spanContentWithMarker = spanContent.slice(0, marker.position - defs.textSpan.start) + `/*${startMarkerName}*/` + spanContent.slice(marker.position - defs.textSpan.start); | |||
const suggestedFileContent = (fileContent.slice(0, defs.textSpan.start) + `\x1b[1;4m[|${spanContentWithMarker}|]\x1b[31m` + fileContent.slice(ts.textSpanEnd(defs.textSpan))) | |||
const suggestedFileContent = (fileContent.slice(0, defs.textSpan.start) + `\x1b[1;4m[|${spanContentWithMarker}|]\x1b[0;31m` + fileContent.slice(ts.textSpanEnd(defs.textSpan))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
look to see colour markup in error messages
Co-authored-by: Nathan Shively-Sanders <[email protected]>
Fixes #39895