From 80e2366f7da953dc952acb408cce6ca76e5a3056 Mon Sep 17 00:00:00 2001 From: simon hsu Date: Tue, 6 Jan 2026 13:40:53 +0800 Subject: [PATCH] feat: Add ClientFeature support for secondary text in completion items --- src/serverprotocol/PasLS.ClientProfile.pas | 6 ++++-- src/serverprotocol/PasLS.Completion.pas | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/serverprotocol/PasLS.ClientProfile.pas b/src/serverprotocol/PasLS.ClientProfile.pas index ce841bc..dab2a40 100644 --- a/src/serverprotocol/PasLS.ClientProfile.pas +++ b/src/serverprotocol/PasLS.ClientProfile.pas @@ -34,7 +34,8 @@ interface cfExcludeInterfaceMethodDecls, // Don't include method/function/procedure declarations from interface section cfExcludeImplClassDefs, // Don't include class definitions from implementation section cfNullDocumentVersion, // Use nil instead of 0 for document version - cfFilterTextOnly // Only set filterText in completion, not label + cfFilterTextOnly, // Only set filterText in completion, not label + cfUseSecondaryText // Use secondaryText field in completion items ); TClientFeatures = set of TClientFeature; @@ -78,7 +79,8 @@ implementation 'excludeInterfaceMethodDecls', 'excludeImplClassDefs', 'nullDocumentVersion', - 'filterTextOnly' + 'filterTextOnly', + 'useSecondaryText' ); function TryStrToFeature(const S: string; out F: TClientFeature): Boolean; diff --git a/src/serverprotocol/PasLS.Completion.pas b/src/serverprotocol/PasLS.Completion.pas index dabf8c9..445780f 100644 --- a/src/serverprotocol/PasLS.Completion.pas +++ b/src/serverprotocol/PasLS.Completion.pas @@ -66,8 +66,8 @@ procedure TCompletionItemHelper.SetPrimaryText(text: string); procedure TCompletionItemHelper.SetSecondaryText(text: string); begin - if not TClientProfile.Current.HasFeature(cfFilterTextOnly) then - &label := text; + if (not TClientProfile.Current.HasFeature(cfFilterTextOnly)) and TClientProfile.Current.HasFeature(cfUseSecondaryText) then + &label := &label + ' ' + text; end;