From db25e94380f69e0d36133bbabb5454127c264b7c Mon Sep 17 00:00:00 2001 From: luoliwoshang <2643523683@qq.com> Date: Tue, 9 Apr 2024 18:04:42 +0800 Subject: [PATCH] update:support yap test codelens --- src/goDocumentSymbols.ts | 2 +- src/goRunTestCodelens.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/goDocumentSymbols.ts b/src/goDocumentSymbols.ts index cb18669e92..0faf0158c6 100644 --- a/src/goDocumentSymbols.ts +++ b/src/goDocumentSymbols.ts @@ -60,7 +60,7 @@ export class GoplsDocumentSymbolProvider implements vscode.DocumentSymbolProvide const start = text.indexOf(packageDecl); pkgDeclRng = new vscode.Range(document.positionAt(start), document.positionAt(start + packageDecl.length)); pkgName = packageDecl[1]; - } else if (document.fileName.endsWith('_test.gop')) { + } else if (document.fileName.endsWith('_test.gop') || document.fileName.endsWith('_ytest.gox')) { pkgName = 'main'; // goxls: default test pkg } const packageSymbol = new vscode.DocumentSymbol( diff --git a/src/goRunTestCodelens.ts b/src/goRunTestCodelens.ts index 5bf9802daa..7026cb0a95 100644 --- a/src/goRunTestCodelens.ts +++ b/src/goRunTestCodelens.ts @@ -47,7 +47,12 @@ export class GoRunTestCodeLensProvider extends GoBaseCodeLensProvider { const config = getGoConfig(document.uri); const codeLensConfig = config.get<{ [key: string]: any }>('enableCodeLens'); const codelensEnabled = codeLensConfig ? codeLensConfig['runtest'] : false; - if (!codelensEnabled || (!document.fileName.endsWith('_test.go') && !document.fileName.endsWith('_test.gop'))) { + if ( + !codelensEnabled || + (!document.fileName.endsWith('_test.go') && + !document.fileName.endsWith('_test.gop') && + !document.fileName.endsWith('_ytest.gox')) + ) { return []; }