admin管理员组文章数量:1125411
maybe I'm just doing something obvious wrong, as I don't have any LSP or really TS experience.
I am currently trying to implement an Language server using the vscode-languageserver/node
package, but cannot get the activeParameter
for the Signatures to work. (Taken from MS LSP Specifications)
This is my signatureHelp.ts
:
import {
Connection,
SignatureHelp,
SignatureHelpContext,
SignatureHelpParams,
SignatureInformation,
} from 'vscode-languageserver/node';
export function handleSignatureHelp(connection: Connection) {
connection.onSignatureHelp((params: SignatureHelpParams): SignatureHelp | null => {
console.log('Signature Help Params:', params);
const signatures: SignatureInformation[] = [
{
label: 'set_bapi_val(bapi_string: string, kennung: string, wert: string)',
documentation: {
kind: 'markdown',
value: 'Replaces or appends a specified entry in a BAPI string.'
},
parameters: [
{ label: 'bapi_string', documentation: 'The BAPI string to modify.' },
{ label: 'kennung', documentation: 'Identifier to replace or append.' },
{ label: 'wert', documentation: 'Value to set.' }
],
},
];
const context: SignatureHelpContext | undefined = params.context;
const activeSignatureIndex = context?.activeSignatureHelp?.activeSignature ?? 0;
console.log(context?.activeSignatureHelp?.activeSignature);
const activeParameterIndex = context?.activeSignatureHelp?.activeParameter ?? 0;
console.log(context?.activeSignatureHelp?.activeParameter);
return {
signatures,
activeSignature: activeSignatureIndex,
activeParameter: activeParameterIndex,
};
});
}
But no matter what I do or try, the activeSignature and activeParameter just stay 0, no matter at what parameter I am actually at.
Image:
Am I just misinterpreting the spec or is there something else going on? My client has contextSupport and activeParameterSupport enabled.
Output:
Signature Help Params: {
textDocument: { uri: 'file:///c%3A/Projects/awdawd.hsc' },
position: { line: 102, character: 35 },
context: {
isRetrigger: true,
triggerCharacter: ',',
triggerKind: 2,
activeSignatureHelp: { signatures: [Array], activeSignature: 0, activeParameter: 0 }
}
}
According to my understanding and the specs, the highlighted parameter should dynamically change, depending on where I am on the client-side of the plugin. But for whatever reason the values just stay "undefined", always highlighting only the first entry.
Thanks
本文标签: typescriptLSP SignatureHelpactiveParameter not dynamically changingStack Overflow
版权声明:本文标题:typescript - LSP SignatureHelp.activeParameter not dynamically changing - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736659917a1946366.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论