How to interact with typescript language server programetically?

I am trying to build an app for user searching queries through language server. Maybe later on that can be enhanced with chatgpt for converting inference data to natural text. The issue I am stuck on is the search symbols api does not seem to be working at all. ( Check attached screenshot ). Test case here: https://github.com/sansmoraxz/tambla/blob/main/test/lsp.test.ts
GitHub
tambla/test/lsp.test.ts at main · sansmoraxz/tambla
Contribute to sansmoraxz/tambla development by creating an account on GitHub.
No description
Solution:
OK I figured it out, we have to pass all these stuff in initialization params: ```json { hostInfo: 'vscode',...
Jump to solution
1 Reply
Solution
sansmoraxz
sansmoraxz8mo ago
OK I figured it out, we have to pass all these stuff in initialization params:
{
hostInfo: 'vscode',
plugins: [],
preferences: {
allowIncompleteCompletions: true,
allowRenameOfImportPath: true,
allowTextChangesInNewFiles: true,
displayPartsForJSDoc: true,
generateReturnInDocTemplate: true,
includeAutomaticOptionalChainCompletions: true,
includeCompletionsForImportStatements: true,
includeCompletionsForModuleExports: true,
includeCompletionsWithClassMemberSnippets: true,
includeCompletionsWithInsertText: true,
includeCompletionsWithSnippetText: true,
jsxAttributeCompletionStyle: 'auto',
providePrefixAndSuffixTextForRename: true,
},
tsserver: {
// With default `auto`, due to dynamic routing, some requests would be routed to syntax server while the project
// is loading and return incomplete results so force just a single server for tests.
useSyntaxServer: 'never',
},
}
{
hostInfo: 'vscode',
plugins: [],
preferences: {
allowIncompleteCompletions: true,
allowRenameOfImportPath: true,
allowTextChangesInNewFiles: true,
displayPartsForJSDoc: true,
generateReturnInDocTemplate: true,
includeAutomaticOptionalChainCompletions: true,
includeCompletionsForImportStatements: true,
includeCompletionsForModuleExports: true,
includeCompletionsWithClassMemberSnippets: true,
includeCompletionsWithInsertText: true,
includeCompletionsWithSnippetText: true,
jsxAttributeCompletionStyle: 'auto',
providePrefixAndSuffixTextForRename: true,
},
tsserver: {
// With default `auto`, due to dynamic routing, some requests would be routed to syntax server while the project
// is loading and return incomplete results so force just a single server for tests.
useSyntaxServer: 'never',
},
}
Also we need to send open file notification before we can do anything with the file.
Want results from more Discord servers?
Add your server