Skip to content

use pointCommand in findDefString to allow static-ls to jump to bindings#151

Open
goolord wants to merge 1 commit intojosephsumabat:mainfrom
goolord:main
Open

use pointCommand in findDefString to allow static-ls to jump to bindings#151
goolord wants to merge 1 commit intojosephsumabat:mainfrom
goolord:main

Conversation

@goolord
Copy link
Contributor

@goolord goolord commented Mar 18, 2025

Instead of querying the DB directly, we could use pointCommand to get the location of a name, which means static-ls could jump to the definition of foo in the trivial example

do
  foo <- getFoo
  launchMissles foo

@goolord goolord marked this pull request as draft March 18, 2025 22:36
@goolord goolord marked this pull request as ready for review March 19, 2025 05:20
@josephsumabat
Copy link
Owner

josephsumabat commented Apr 10, 2025

Is the local definition not working for you? We already look up the hiefile in the snippet above

      identifiers <- runMaybeT $ do
        hieLineCol <- lineColToHieLineCol path lineCol
        hiePos <- hieLineColToPos path hieLineCol
        valid <- lift $ isHiePosValid path pos hiePos
        Monad.guard valid
        hieView <- getHieView path
        let identifiers = HieView.Query.fileIdentifiersAtRangeList (Just (LineColRange.point hieLineCol)) hieView
        pure identifiers

(This does effectively the same thing as pointCommand)

findDefString is only intended as a fallback mechanism when we don't have an hie file

(Let me know if I'm missing anything else here)

@goolord
Copy link
Contributor Author

goolord commented Apr 10, 2025

yes, goto definition isn't working for local bindings on master. I guess I missed fileIdentifiersAtRangeList since I was mostly grepping around for hiedb functions to debug this. not sure why that wouldn't work, but I can tell you using pointCommand is working for certain

@josephsumabat
Copy link
Owner

josephsumabat commented Apr 16, 2025

I'm going to take some time to look into this before making a decision on merging or closing. we probably still want some fallback if hie files are not available

@josephsumabat josephsumabat force-pushed the main branch 2 times, most recently from d5385fd to 4a20b01 Compare April 16, 2025 20:39
@josephsumabat josephsumabat force-pushed the main branch 2 times, most recently from 2f843c0 to 676f2d3 Compare May 14, 2025 16:56
@Mycatty
Copy link

Mycatty commented Aug 12, 2025

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants