Repository navigation
Conversation
Ask the client to request inlay hints and semantic tokens again when the configuration changes, the schema cache is invalidated, a statement is executed, or the database becomes reachable after they were requested without it. Add inlayHints.enabled and semanticTokens.enabled, and rewrite the editor features docs.
This branch has not been deployed
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.
Stacked on #888.
Inlay hints and semantic tokens stayed stale until the next edit whenever they changed for another reason, and there was no way to turn them off on the server side.
What was broken
pgls.invalidateSchemaCache, a configuration change, or a database that came up after the first request returned nothing, hints and tokens kept showing the old state (or nothing) until the user typed. Diagnostics are refreshed at these points, hints and tokens weren't: there was noworkspace/inlayHint/refreshorworkspace/semanticTokens/refreshanywhere.What changed
Session::refresh_editor_featuressends both refresh requests, each only if the client declaresrefreshSupport, without waiting for the answer. It runs:update_all_diagnostics, which coversinitialized,workspace/didChangeConfiguration,pgls/set_configuration_overridesandpgls.executeStatement;pgls.invalidateSchemaCache, which now also refreshes diagnostics (they depend on the schema too and didn't refresh before);check_database_connectionand refreshes once it works.{ "inlayHints": { "enabled": false }, "semanticTokens": { "enabled": false } }Both default to
true. When disabled, the workspace returns no hints/tokens, so the editor keeps its grammar highlighting. The capabilities are still advertised; switching at runtime then only needs the refresh.docs/features/editor_features.mdis rewritten ("Editor Features"): hover through the file's DDL, SQL function bodies and CTE/subquery columns, inlay hints, semantic tokens with the token table and enum rules, how to turn them off, and a limitations list (unique references only,DO/CALL/unparsable statements,CALL,BEGIN ATOMICand''bodies, missing token kinds, large files). The follow-up PRs that lift some of these limitations update the list.Tests
LSP test
test_editor_features_refresh_and_settings: a client with refresh support gets both refresh requests after the configuration is loaded, afterpgls.invalidateSchemaCache, and after adidChangeConfigurationthat disables both features, after which hints and tokens are empty. The test client now answers refresh requests and forwards them as notifications.Not covered
Follow-ups: The parameter-name mode is added in #948.