Skip to content
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

feature: force ignore directory, or respect underscore convention? #35

Closed
mpl opened this issue Jun 11, 2020 · 6 comments
Closed

feature: force ignore directory, or respect underscore convention? #35

mpl opened this issue Jun 11, 2020 · 6 comments

Comments

@mpl
Copy link

mpl commented Jun 11, 2020

Hi,

In an existing github project where I contribute (https://github.com/containous/yaegi), they have a "_test" directory at the root, containing .go files, each of them being a main package.
I know they're not supposed to have more than one main in a directory, but on the other hand, since the directory starts with an underscore, it is ignored by the go tool ('go test ./...' at the root runs fine), as I think is the convention.

The reason I'm bringing this up, is because it seems acme-lsp chokes on that structure. If I add the project with L ws+, most things work fine with the L commands. However, as soon as I open in acme one of the files in the _test dir, acme-lsp seems to enter an infinite loop and burning CPU, spewing errors in /LSP/Diagnostics forever.

So don't you think acme-lsp should ignore any file or directory starting with an underscore, as the go tool does? Or if not, could we have a configuration option that tells it to ignore a specific directory? If not, can you think of any other work-around I could use?

I was thinking that in the meantime maybe I could add build tags to all of the files in the _test directory, but I'm not sure that would do the trick, I haven't tried yet.

@fhs
Copy link
Collaborator

fhs commented Jun 11, 2020

As workaround, you can choose to not send those files to acme-lsp:

acme-lsp -server '^[^_]+/[^/]+\.go$:gopls' 

Check you don't have any old configuration with -showconfig:

$ acme-lsp -server '^[^_]+/[^/]+\.go$:gopls' -showconfig
[Servers]
  [Servers._userCmdServer0]
    Command = ["gopls"]
...
[[FilenameHandlers]]
  Pattern = "^[^_]+/[^/]+\\.go$"
  ServerKey = "_userCmdServer0"

The regexp is not ideal because it will also exclude other directories with underscore in them.

I need to investigate why acme-lsp is getting into infinite loop. I wasn't able to reproduce the issue on vscode.

@mpl
Copy link
Author

mpl commented Jun 11, 2020

As workaround, you can choose to not send those files to acme-lsp:

acme-lsp -server '^[^_]+/[^/]+\.go$:gopls' 

Cool, thanks, I'll try it out tomorrow.

Check you don't have any old configuration with -showconfig:

$ acme-lsp -server '^[^_]+/[^/]+\.go$:gopls' -showconfig
[Servers]
  [Servers._userCmdServer0]
    Command = ["gopls"]
...
[[FilenameHandlers]]
  Pattern = "^[^_]+/[^/]+\\.go$"
  ServerKey = "_userCmdServer0"

The regexp is not ideal because it will also exclude other directories with underscore in them.

yeah, fair enough. It should be fine for my use-case and my daily work though, so I can definitely live with that in the meantime.

I need to investigate why acme-lsp is getting into infinite loop. I wasn't able to reproduce the issue on vscode.

@mpl
Copy link
Author

mpl commented Jun 12, 2020

the exclusion regex seems to do the trick for now, thanks!

@fhs
Copy link
Collaborator

fhs commented Jun 12, 2020

It's actually not a infinite loop I originally thought. It's just really slow because it redraws the whole window after each new diagnostic. I think I can make it fast for few hundred diagnostics, but it's going to be a challenge for 1000+ diagnostics. So, I've opened a gopls issue: golang/go#39563

fhs added a commit that referenced this issue Jun 13, 2020
All current diagnostics were being written every time we received a new
diagnostics update. Instead, we now queue diagnostics and write them
every second if the queue changed.

Update #35
@mpl
Copy link
Author

mpl commented Jun 14, 2020

It's actually not a infinite loop I originally thought. It's just really slow because it redraws the whole window after each new diagnostic. I think I can make it fast for few hundred diagnostics, but it's going to be a challenge for 1000+ diagnostics. So, I've opened a gopls issue: golang/go#39563

Ah ok, good to know. I must admit I probably only left acme-lsp to run for a minute tops, as the CPU usage was making my laptop noisy, so I never saw it actually stop spewing diagnostics.

@fhs
Copy link
Collaborator

fhs commented Oct 22, 2020

I think the issue was fixed on gopls v0.5.0, which was released last month. Closing.

@fhs fhs closed this as completed Oct 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants