Skip past module.exports = { Foo } in go-to-defintion on 'Foo'#40835
Merged
andrewbranch merged 5 commits intomicrosoft:masterfrom Oct 5, 2020
Merged
Skip past module.exports = { Foo } in go-to-defintion on 'Foo'#40835andrewbranch merged 5 commits intomicrosoft:masterfrom
module.exports = { Foo } in go-to-defintion on 'Foo'#40835andrewbranch merged 5 commits intomicrosoft:masterfrom
Conversation
sandersn
approved these changes
Oct 5, 2020
Member
sandersn
left a comment
There was a problem hiding this comment.
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) { |
Member
Author
There was a problem hiding this comment.
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.
| 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))) |
Member
There was a problem hiding this comment.
look to see colour markup in error messages
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #39895