nwolverson / purescript-language-server

MIT License
183 stars 41 forks source link

Auto import suggestions do not work (sometimes) #164

Closed wclr closed 2 years ago

wclr commented 2 years ago

I quite sometimes now meat the situation when auto import suggestions do not work.

image

I see nothing particular in the log, and didn't dig it not it, any suggestions on what can go wrong?

wclr commented 2 years ago

Seems it doesn't work if the unkown token comes after the bracket: ( or [.

nwolverson commented 2 years ago

I can reproduce that, thanks

wclr commented 2 years ago

To fix that, need to handle additional tokens:

              TokLeftParen -> go $ TokenStream.step str
              TokLeftSquare -> go $ TokenStream.step str

https://github.com/nwolverson/purescript-language-server/blob/master/src/IdePurescript/Tokens.purs#L46

I can add PR.

nwolverson commented 2 years ago

Why does that not just happen on the next iteration, is the "point" that is called into this function the location of the paren? Seems like the real cause must be upstream - maybe an off by one. Actually not sure if start/end columns are inclusive or not, that would be relevant here

wclr commented 2 years ago

Ok, I didn't figure it out quite carefully. This would be fixed with just making operator inclusive in else if column >= endCol then.

nwolverson commented 2 years ago

That seems to work out, I can verify it fixed the above. Thanks!