Skip to content

Commit

Permalink
fix: stop calling unbound tsserver method
Browse files Browse the repository at this point in the history
  • Loading branch information
auvred committed Jan 3, 2024
1 parent 0ee6995 commit 446a7b6
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,23 @@ export async function quickInfoRequest(
}

// https://github.com/neoclide/coc-tsserver/blob/9ff880ef3fbf1680daefe4dacfafdce8ffd2817b/src/server/index.ts#L15
const { clientHost } = tsserverService
const clientHost = tsserverService?.clientHost

// https://github.com/neoclide/coc-tsserver/blob/9ff880ef3fbf1680daefe4dacfafdce8ffd2817b/src/server/typescriptServiceClientHost.ts#L37
const client = clientHost?.client

// https://github.com/neoclide/coc-tsserver/blob/9ff880ef3fbf1680daefe4dacfafdce8ffd2817b/src/server/typescriptServiceClient.ts#L613
const execute = client?.execute

return await (execute?.('quickinfo', {
file: coc.Uri.parse(model.uri).fsPath,
line: position.line + 1,
offset: position.character,
} satisfies ts.server.protocol.FileLocationRequestArgs) as Promise<
ts.server.protocol.QuickInfoResponse | undefined
>)
try {
// https://github.com/neoclide/coc-tsserver/blob/9ff880ef3fbf1680daefe4dacfafdce8ffd2817b/src/server/typescriptServiceClient.ts#L613
return await (client?.execute?.('quickinfo', {
file: coc.Uri.parse(model.uri).fsPath,
line: position.line + 1,
offset: position.character,
} satisfies ts.server.protocol.FileLocationRequestArgs) as Promise<
ts.server.protocol.QuickInfoResponse | undefined
>)
} catch (e) {
console.log(e)
}
}

interface InlayHintInfo {
Expand Down

0 comments on commit 446a7b6

Please sign in to comment.