Inlay hints M8: port and parameter names on ordered lists
textDocument/inlayHint draws ghost portname:/PARAM: labels on positional connection lists and all-positional #(...) overrides, from the same plan extraction M4 uses — walked off the parse tree, so nested-call commas cannot shift positions. Range filtering runs before any definition is parsed; plans are cached per request (O(distinct modules)); every uncertainty is silent, including QA's find: an ifdef-carrying port list unions its arms in the plan, which is right for an editable skeleton and wrong for a read-only label, so such plans now hint nothing. Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
3c55783e09
commit
fa38fd9dec
8 files changed
+1425
-15
No files matched your search
@@ -14,6 +14,7 @@ mod diagnostics;
|
||||
mod folding;
|
||||
mod format;
|
||||
mod hover;
|
||||
mod inlay;
|
||||
mod lint;
|
||||
mod locate;
|
||||
mod nav;
|
||||
@@ -35,11 +36,11 @@ use std::path::PathBuf;
|
||||
use lsp_server::Connection;
|
||||
use lsp_types::{
|
||||
CodeActionKind, CodeActionOptions, CodeActionProviderCapability, CompletionOptions,
|
||||
ExecuteCommandOptions, FoldingRangeProviderCapability, InitializeParams, OneOf,
|
||||
PositionEncodingKind, RenameOptions, SemanticTokensFullOptions, SemanticTokensLegend,
|
||||
SemanticTokensOptions, SemanticTokensServerCapabilities, ServerCapabilities,
|
||||
SignatureHelpOptions, TextDocumentSyncCapability, TextDocumentSyncKind,
|
||||
WorkDoneProgressOptions,
|
||||
ExecuteCommandOptions, FoldingRangeProviderCapability, InitializeParams, InlayHintOptions,
|
||||
InlayHintServerCapabilities, OneOf, PositionEncodingKind, RenameOptions,
|
||||
SemanticTokensFullOptions, SemanticTokensLegend, SemanticTokensOptions,
|
||||
SemanticTokensServerCapabilities, ServerCapabilities, SignatureHelpOptions,
|
||||
TextDocumentSyncCapability, TextDocumentSyncKind, WorkDoneProgressOptions,
|
||||
};
|
||||
|
||||
use crate::server::Server;
|
||||
@@ -134,6 +135,15 @@ fn capabilities() -> ServerCapabilities {
|
||||
retrigger_characters: None,
|
||||
work_done_progress_options: WorkDoneProgressOptions::default(),
|
||||
}),
|
||||
// Port and parameter names on ordered connection lists. Every hint is
|
||||
// returned complete — a label, a position and nothing to fetch later —
|
||||
// so there is no `inlayHint/resolve`.
|
||||
inlay_hint_provider: Some(OneOf::Right(InlayHintServerCapabilities::Options(
|
||||
InlayHintOptions {
|
||||
work_done_progress_options: WorkDoneProgressOptions::default(),
|
||||
resolve_provider: None,
|
||||
},
|
||||
))),
|
||||
semantic_tokens_provider: Some(SemanticTokensServerCapabilities::SemanticTokensOptions(
|
||||
SemanticTokensOptions {
|
||||
work_done_progress_options: WorkDoneProgressOptions::default(),
|
||||
@@ -210,6 +220,17 @@ mod tests {
|
||||
assert!(caps.execute_command_provider.is_some());
|
||||
assert!(caps.completion_provider.is_some());
|
||||
assert!(caps.signature_help_provider.is_some());
|
||||
assert!(caps.inlay_hint_provider.is_some());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn inlay_hints_resolve_nothing_because_every_hint_is_complete() {
|
||||
let Some(OneOf::Right(InlayHintServerCapabilities::Options(options))) =
|
||||
capabilities().inlay_hint_provider
|
||||
else {
|
||||
panic!("inlay hints must carry options, not a bare `true`");
|
||||
};
|
||||
assert_eq!(options.resolve_provider, None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user