-
Notifications
You must be signed in to change notification settings - Fork 748
Port document symbol tests + fixes #2207
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
base: main
Are you sure you want to change the base?
Conversation
| completionsAtIncompleteObjectLiteralProperty | ||
| completionsSelfDeclaring1 | ||
| completionsWithDeprecatedTag4 | ||
| navigationBarFunctionPrototype |
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.
All of those tests had .js files and needed // @allowJs: true to be added. Strada didn't need this because document symbol did not need to obtain the file from a program, it just obtained the file from a syntax cache (?). In Corsa, we try to get the requested file from the program, so these tests crashed. One thing I've been wanting to do is to use the same inferred project default settings for fourslash, but this would break a few import code fix tests, so I didn't do it in this PR.
| "start": { | ||
| "line": 1, | ||
| "character": 0 | ||
| }, | ||
| "end": { | ||
| "line": 7, | ||
| "character": 1 | ||
| } |
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.
In some way, I wonder if we should also override printing of ranges in the baseline into something more compact.
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.
Do you have ideas as to what would be more compact? I guess I could either make it print the ranges single line, or print the text of the range instead, though that would mean stringifying the text to produce valid json.
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.
I could imagine [[1, 2], [3, 4]] or "1,2-3,4", but I don't really know.
I don't think we've been this clever with other tests, though things like sig help baselines previously used postition and not line/char. I don't mind leaving this as-is, but it is a lot of baselines, so I was speculating.
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.
Crazy idea but what about printing inline like
/*Method getDist L2C4-L2C22*/«‹getDist›(): number»
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.
Or you can just do something like
(Interface) IPoint - selectionRange L1C10-L1C16, range L1C0-L7C1
└── (Method) getDist - selectionRange L2C4-L2C11, range L2C4-L2C22
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.
Crazy idea but what about printing inline like
/*Method getDist L2C4-L2C22*/«‹getDist›(): number»
I think I'm gonna do what we do for workspace symbols and other baselines where we place markers in the file to indicate positions.
Or you can just do something like
(Interface) IPoint - selectionRange L1C10-L1C16, range L1C0-L7C1 └── (Method) getDist - selectionRange L2C4-L2C11, range L2C4-L2C22
And then do something like this for indicating the hierarchy maybe?
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
In Strada, the document symbol tests (i.e.
navigationTree) were not baseline tests. I initially ported those tests as they were in Strada, but some 40 tests failed, and mostly due to intentional differences, and so I just went through every failing test, fixed the most relevant differences, and re-ported the tests as baseline tests. Long term I think baseline tests are what we want for document symbol, and I think keeping diffs was going to be too noisy anyways.I had to add support in document symbol for expandos and some other missing things like name truncation.
Noticeable differences:
import *{} from 'foo'won't include an unnamed namespace import).Still missing:
Object.defineProperty(...)is missing because we still haven't added support for this construct yet in Corsa. SeenavigationBarFunctionPrototype_test.go. If we add support for it by reparsing it into something else, we'll just need to update thenewDocumentSymbolto allow that reparsed node, but that should be a quick change.If the baseline format is ok, I can add a similar baselining function for workspace symbols too, since it's likely we'll want to use that for new tests going forward.