-
-
Notifications
You must be signed in to change notification settings - Fork 347
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
hls-cabal-plugin: refactor context search to use readFields
#4186
base: master
Are you sure you want to change the base?
Conversation
9060700
to
16a201c
Compare
readFields
readFields
16a201c
to
46ad7dd
Compare
46ad7dd
to
b5587a8
Compare
b5587a8
to
02f3bf9
Compare
ad60fbb
to
818e6ee
Compare
c5711f4
to
6d9778e
Compare
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 good to me, very interesting idea!
Why is the test not running |
Hm, I am also confused. Perhaps all my force pushing messed up the CI :) |
Will it help with #3333 |
No, this tries to fix some bugs in the cabal file completions that I encountered while dogfooding the plugin. This does not affect the tests at all. The tests are flaky, for the same reason hlint tests are/were flaky, afaict. |
6d9778e
to
5f70b19
Compare
Add utils that allows to define parameterised tests for files that require cursor positions. This enables us to define run the same tests for multiple inputs efficiently, and with readable error messages. The main advantage is the improved specification of the test cases, as we allow to specify the cursor position directly in the source of the test files.
Instead of custom parsing of the cabal file, we use `readFields` to parse the cabal file, as accurately as cabal supports. This allows us to additionally benefit from future improvements to the cabal lexer. Then, we traverse the fields and find the most likely location of the cursor in the cabal file. Based on these results, we can then establish the context accurately. Further, we extend the known rules for the cabal plugin, to avoid expensive reparsing using `readFields`. Co-authored-by: VeryMilkyJoe <jana.chadt@nets.at>
5f70b19
to
ffc5942
Compare
Replace the more brittle parser with cabal's
readFields
.Ready for review :)