Add LSP filesystem path and proto type completions#4528
Open
stefanvanburen wants to merge 1 commit intomainfrom
Open
Add LSP filesystem path and proto type completions#4528stefanvanburen wants to merge 1 commit intomainfrom
stefanvanburen wants to merge 1 commit intomainfrom
Conversation
Quick follow-up to #4527. Filesystem path completions for path-valued fields in `buf.yaml` (`modules[*].path`, `modules[*].includes`, `modules[*].excludes`, `lint.ignore`, `breaking.ignore`, `policies[*].ignore`, `{lint,breaking}.ignore_only.RULE_ID`) and `buf.gen.yaml` (`plugins[*].out`, `inputs[*].directory`, `inputs[*].paths`, `inputs[*].exclude_paths`). Reads the directory of the config file and offers matching files and directories, filtered by prefix. Directory- only keys (`path`, `out`, `directory`, `includes`, `excludes`) suppress file entries. Proto type completions for `buf.gen.yaml` `types` and `exclude_types` sequences. Eagerly leases the workspace on first `Track` to make fully-qualified message, enum, and service names available; the lease is reused across subsequent `Track`s to avoid running `workspace.Refresh` on every keystroke. Also offer rule ID completions for `policies[*].ignore_only` by adding a `"policies"` case to `bufYAMLIgnoreOnlyKeyItems` that returns the union of lint and breaking rule IDs, since a policy can suppress either kind. This should make our completions better than what `yaml-language-server` could provide, as the JSONSchema has no way to designate a field as a "directory" or "file" for completions.
Contributor
|
The latest Buf updates on your PR. Results from workflow Buf CI / buf (pull_request).
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Quick follow-up to #4527.
Filesystem path completions for path-valued fields in
buf.yaml(modules[*].path,modules[*].includes,modules[*].excludes,lint.ignore,breaking.ignore,policies[*].ignore,{lint,breaking}.ignore_only.RULE_ID) andbuf.gen.yaml(plugins[*].out,inputs[*].directory,inputs[*].paths,inputs[*].exclude_paths). Reads the directory of the config file and offers matching files and directories, filtered by prefix. Directory- only keys (path,out,directory,includes,excludes) suppress file entries.Proto type completions for
buf.gen.yamltypesandexclude_typessequences. Eagerly leases the workspace on firstTrackto make fully-qualified message, enum, and service names available; the lease is reused across subsequentTracks to avoid runningworkspace.Refreshon every keystroke.Also offer rule ID completions for
policies[*].ignore_onlyby adding a"policies"case tobufYAMLIgnoreOnlyKeyItemsthat returns the union of lint and breaking rule IDs, since a policy can suppress either kind.This should make our completions better than what
yaml-language-servercould provide, as the JSONSchema has no way to designate a field as a "directory" or "file" for completions.