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

Implement breaking lints in the LSP #3404

Merged
merged 10 commits into from
Nov 26, 2024
Merged

Implement breaking lints in the LSP #3404

merged 10 commits into from
Nov 26, 2024

Conversation

mcy
Copy link
Member

@mcy mcy commented Oct 16, 2024

This change adds breaking lints to the LSP as part of the general lint pass.

Breaking lints are interesting because they need an "against". I've chosen to expose two configuration knobs (which are set in the settings for an LSP in the standard way):

  1. buf.against sets the against strategy. For the LSP, there are three that reasonably make sense: against some remote's HEAD, against your local HEAD, and against whatever is on disk. This means that lints go away when pushing to main, committing working changes, or saving in the editor, respectively.
  2. buf.gitRemote, the remote to use for the above. "origin" is the default for almost everyone, but it need not be that, so it's a config knob.

Also, in the process of standing up loading config settings from the client, I found a deadlock in the jsonrpc2 library. To work around it, every request runs on its own goroutine (although they are still serialized wrt to the big LSP lock). This ensures that the single goroutine jsonrpc2 spawns to actually poll the IPC socket doesn't deadlock. Why do they only spawn one goroutine? Presumably because they expect users to spawn a goroutine to handle each request, but this does not appear to be visibly documented. (Much debugging of deadlocked goroutines happened today.)

@mcy mcy requested review from bufdev and doriable October 16, 2024 19:52
Copy link
Contributor

github-actions bot commented Oct 16, 2024

The latest Buf updates on your PR. Results from workflow Buf CI / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedNov 25, 2024, 6:23 PM

private/buf/buflsp/file.go Outdated Show resolved Hide resolved
private/buf/buflsp/buflsp.go Outdated Show resolved Hide resolved
private/buf/buflsp/file.go Outdated Show resolved Hide resolved
private/buf/buflsp/file.go Outdated Show resolved Hide resolved
private/buf/buflsp/file.go Outdated Show resolved Hide resolved
private/pkg/git/git.go Outdated Show resolved Hide resolved
@mcy mcy requested a review from doriable October 24, 2024 15:59
private/buf/buflsp/server.go Outdated Show resolved Hide resolved
private/buf/buflsp/config.go Outdated Show resolved Hide resolved
private/buf/buflsp/config.go Outdated Show resolved Hide resolved
private/buf/buflsp/config.go Outdated Show resolved Hide resolved
private/buf/buflsp/file.go Outdated Show resolved Hide resolved
private/buf/buflsp/file.go Outdated Show resolved Hide resolved
private/buf/buflsp/file.go Outdated Show resolved Hide resolved
private/buf/buflsp/file.go Outdated Show resolved Hide resolved
@mcy mcy requested a review from doriable November 19, 2024 18:25
Copy link
Member

@doriable doriable left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for putting in these changes -- we should add a changelog entry for this and this is probably good to merge.

@mcy mcy requested a review from doriable November 21, 2024 21:11
@mcy mcy merged commit 9e94044 into main Nov 26, 2024
10 checks passed
@mcy mcy deleted the mcy/lsp-breaking branch November 26, 2024 22:55
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.

2 participants