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

x/tools/gopls: make file size limit configurable #57660

Open
seebs opened this issue Jan 6, 2023 · 2 comments
Open

x/tools/gopls: make file size limit configurable #57660

seebs opened this issue Jan 6, 2023 · 2 comments
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@seebs
Copy link
Contributor

seebs commented Jan 6, 2023

gopls version

just says it's "master", which is commit 36bd3dbc

go env

N/A

What did you do?

have bloated code but a very fast computer

What did you expect to see?

semantic highlighting anyway

What did you see instead?

an arbitrary file size limit on semantic tokens which seems very small to me

Editor and settings

vscode

Logs

N/A

Basically: I think maxFullFileSize should be configurable.

Ideally, the people doing the vscode plugin would start using ranges and do semantic token queries on ranges rather than on the full file. But since they don't seem to be doing that, it would be nice to have a setting that could be exposed to allow people who need slightly larger files highlighted to do that.

(Unrelatedly, I just build my own copy, and that used to work, but stopped for reasons I can't figure out, but that got me to thinking "hey why is this a hard-coded limit anyway".)

@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Jan 6, 2023
@gopherbot gopherbot added this to the Unreleased milestone Jan 6, 2023
@findleyr
Copy link
Contributor

findleyr commented Jan 6, 2023

(Unrelatedly, I just build my own copy, and that used to work, but stopped for reasons I can't figure out, but that got me to thinking "hey why is this a hard-coded limit anyway".)

We're in the middle of a lot of big fundamental changes, if you built from master, so I'm not entirely surprised if something broke for you. In what way did it not work? (CC @adonovan)

CC @pjweinb for the semantic token file size limit question.

@seebs
Copy link
Contributor Author

seebs commented Jan 9, 2023

The way it doesn't work is that, on large files, there's no syntax highlighting. "Large" appears to be exactly 100,000 bytes. I added logging to gopls to announce when it was doing semantic highlighting.

On small files, when I open them for the first time, I see:

semantic.go:100: considering semantics for file, len 54803
semantic.go:128: computed on len 54803: 24685 uint32 of result
semantic.go:100: considering semantics for file, len 54803
semantic.go:128: computed on len 54803: 1775 uint32 of result
semantic.go:100: considering semantics for file, len 54803
semantic.go:128: computed on len 54803: 24685 uint32 of result

and when I click on their tabs, I just see the last pair of lines every time I click on the tab.

With larger files, I see the first two pairs of lines when I open them, and nothing when I click on their tab, and they are not colorized.

Someone suggested changing the registration (lsp/workspace.go) to Full: false, and doing this removes the first of those pairs of lines from each case but changes nothing about the observed behavior.

So I'm reasonably confident that something in vscode-go is, at the point where it would be doing syntax/semantics highlighting, instead choosing not to, but I don't read JavaScript very well to begin with and have been entirely unable to find anything in it that even looks like it is actually the code which is making these requests.

EDIT: If something might be broken on master, what tag/version would you recommend?

@dle8 dle8 added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants