-
-
Notifications
You must be signed in to change notification settings - Fork 401
Open
Labels
HackathonThis issue is suitable for hackathon sessionsThis issue is suitable for hackathon sessionscomponent: hls-cabal-pluginIssues related to the hls-cabal-pluginIssues related to the hls-cabal-plugintype: enhancementNew feature or requestNew feature or request
Description
At the moment, codeactions (PR: #3273) in cabal files put a cursor at the end of the misspelled word and then suggest any possible completions.
This is not ideal, since words that have a typo early on will not trigger the correct codeaction.
We should use a different algorithm for the fuzzy matching than completions to better support the semantics of the codeactions.
Metadata
Metadata
Assignees
Labels
HackathonThis issue is suitable for hackathon sessionsThis issue is suitable for hackathon sessionscomponent: hls-cabal-pluginIssues related to the hls-cabal-pluginIssues related to the hls-cabal-plugintype: enhancementNew feature or requestNew feature or request
Type
Projects
Status
No status
Milestone
Relationships
Development
Select code repository
Activity
JadarTheObscurity commentedon May 13, 2025
Hi! I’m very new to Haskell and to contributing to open source. I came across this issue and thought it would be a great opportunity to learn more about the ecosystem.
I’ve implemented a version of the Smith-Waterman algorithm for fuzzy matching under Text.Fuzzy.Parallel, and I’m interested in exploring how it could help improve code actions in cabal files, as suggested in this issue.
However, I’m not sure which part of the codebase is responsible for the in-editor highlighting of the matched string (as shown in the image below). Could someone point me to the relevant modules or files I should look into?
Since this is both my first time working with a functional language and contributing to a Haskell project, any advice or suggestions on how to approach this issue would be very much appreciated!
fendor commentedon May 13, 2025
Hi, thank you for your interest!
I believe the highlighting is done automatically by VSCode, so it is not something you can control.
Or are you asking for the location where these strings are produced?
JadarTheObscurity commentedon May 13, 2025
fendor commentedon May 13, 2025
This is the entry point for the completions https://github.com/haskell/haskell-language-server/blob/master/plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal.hs#L133 (which is what you see in the screenshot, which is not what this issue is about) and https://github.com/haskell/haskell-language-server/blob/master/plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal.hs#L135 is the entry point for code actions that correct typos in field names.
JadarTheObscurity commentedon May 13, 2025
fendor commentedon May 13, 2025
The easiest way to debug is
traceShowM
and using the logger. You can enableDEBUG
log messages by passing--debug
to theserverExtraArgs
in VSCode.Another good way is to run a single test, for example
cabal test hls-cabal-plugin-tests --test-options='-p "Code Actions - Can fix field names"'
which runs the test here https://github.com/haskell/haskell-language-server/blob/master/plugins/hls-cabal-plugin/test/Main.hs#L189That's often much faster than the manual testing. Same tips apply though, logging and
trace*
are the way to go to debug Haskell right now.