diff --git a/src/goDocumentSymbols.ts b/src/goDocumentSymbols.ts index cb18669e92..7e98392b30 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('test.gox')) { pkgName = 'main'; // goxls: default test pkg } const packageSymbol = new vscode.DocumentSymbol( diff --git a/src/goTest.ts b/src/goTest.ts index 9c3e624d47..d7438a7940 100644 --- a/src/goTest.ts +++ b/src/goTest.ts @@ -48,7 +48,11 @@ async function _testAtCursor( if (!editor) { throw new NotFoundError('No editor is active.'); } - if (!editor.document.fileName.endsWith('_test.go') && !editor.document.fileName.endsWith('_test.gop')) { + if ( + !editor.document.fileName.endsWith('_test.go') && + !editor.document.fileName.endsWith('_test.gop') && + !editor.document.fileName.endsWith('test.gox') + ) { throw new NotFoundError('No tests found. Current file is not a test file.'); } @@ -210,9 +214,8 @@ async function runTestAtCursor( if (cmd !== 'benchmark' && extractInstanceTestName(testFunctionName)) { testConfigFns.push(...findAllTestSuiteRuns(editor.document, testFunctions).map((t) => t.name)); } - const isMod = await isModSupported(editor.document.uri); - const isGop = editor.document.fileName.endsWith('.gop'); // goxls: isGop + const isGop = editor.document.fileName.endsWith('.gop') || editor.document.fileName.endsWith('.gox'); // goxls: isGop const testConfig: TestConfig = { goConfig, dir: path.dirname(editor.document.fileName), @@ -381,7 +384,11 @@ export function testCurrentFile(isBenchmark: boolean, getConfig = getGoConfig): vscode.window.showInformationMessage('No editor is active.'); return false; } - if (!editor.document.fileName.endsWith('_test.go') && !editor.document.fileName.endsWith('_test.gop')) { + if ( + !editor.document.fileName.endsWith('_test.go') && + !editor.document.fileName.endsWith('_test.gop') && + !editor.document.fileName.endsWith('test.gox') + ) { vscode.window.showInformationMessage('No tests found. Current file is not a test file.'); return false; }