catch error on signatureHelp
This commit is contained in:
parent
224dbe4d9e
commit
686f2b2110
1 changed files with 10 additions and 5 deletions
|
@ -2,17 +2,17 @@
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
import { CancellationToken, Position, SignatureHelp, SignatureInformation, TextDocument } from 'vscode-languageserver-protocol'
|
import {CancellationToken, Position, SignatureHelp, SignatureInformation, TextDocument} from 'vscode-languageserver-protocol'
|
||||||
import { SignatureHelpProvider } from 'coc.nvim/lib/provider'
|
import {SignatureHelpProvider} from 'coc.nvim/lib/provider'
|
||||||
import * as Proto from '../protocol'
|
import * as Proto from '../protocol'
|
||||||
import { ITypeScriptServiceClient } from '../typescriptService'
|
import {ITypeScriptServiceClient} from '../typescriptService'
|
||||||
import * as Previewer from '../utils/previewer'
|
import * as Previewer from '../utils/previewer'
|
||||||
import * as typeConverters from '../utils/typeConverters'
|
import * as typeConverters from '../utils/typeConverters'
|
||||||
|
|
||||||
export default class TypeScriptSignatureHelpProvider implements SignatureHelpProvider {
|
export default class TypeScriptSignatureHelpProvider implements SignatureHelpProvider {
|
||||||
public static readonly triggerCharacters = ['(', ',', '<']
|
public static readonly triggerCharacters = ['(', ',', '<']
|
||||||
|
|
||||||
public constructor(private readonly client: ITypeScriptServiceClient) { }
|
public constructor(private readonly client: ITypeScriptServiceClient) {}
|
||||||
|
|
||||||
public async provideSignatureHelp(
|
public async provideSignatureHelp(
|
||||||
document: TextDocument,
|
document: TextDocument,
|
||||||
|
@ -28,7 +28,12 @@ export default class TypeScriptSignatureHelpProvider implements SignatureHelpPro
|
||||||
position
|
position
|
||||||
)
|
)
|
||||||
|
|
||||||
const response = await this.client.interruptGetErr(() => this.client.execute('signatureHelp', args, token))
|
let response
|
||||||
|
try {
|
||||||
|
response = await this.client.interruptGetErr(() => this.client.execute('signatureHelp', args, token))
|
||||||
|
} catch (e) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
if (response.type !== 'response' || !response.body) {
|
if (response.type !== 'response' || !response.body) {
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue