nwolverson / purescript-language-server

MIT License
185 stars 42 forks source link

Repeatedly added qualified imports on completion. #210

Open wclr opened 3 weeks ago

wclr commented 3 weeks ago

I don't remember how long I have been experiencing this issue.

But often when I add qualiifed import, for example I type and press tab to complete:

x = Map.empty

each time it repeatedly adds (may add) new import:

import Data.Map as Map

So I end up with multiple imports added:

import Data.Map as Map
import Data.Map as Map
import Data.Map as Map
import Data.Map as Map

This is also not obviously deterministic: sometimes it happens, sometimes not, but if it happens while editing of a module, it continues. I didn't dig into it yet. But I wonder if i'm the only one experiencing this? Maybe it some how relates to this change (which I don't have).

@nwolverson ?

nwolverson commented 3 weeks ago

Think this is #95 - I never did have a repro, didn't see this myself either

wclr commented 3 weeks ago

Thanks, so it is an old issue, I think I started to encounter it not so long ago.

wclr commented 3 weeks ago

So far it's a bug in purs ide that adds those duplicate imports. I've made a workaround that removes those unnecessary workspace edits produced in addCompletionImportEdit.

As a workaround solution for the upstream issue, I think it is plausible for now to include it?

nwolverson commented 3 weeks ago

I don't have an objection to filtering those undesired edits out if it's straightforward, so long as it's clear so we can back it out later