Fix issue where symbol-provider-ctags used the wrong package root

This commit is contained in:
Andrew Dupont 2024-01-12 12:42:01 -08:00
parent 865153b471
commit ddfa645122
2 changed files with 10 additions and 2 deletions

View File

@ -62,11 +62,11 @@ class CtagsProvider {
const {resourcePath} = atom.getLoadSettings();
const currentFileWasRequiredFromSnapshot = !fs.isAbsolute(__dirname);
const packageRoot = currentFileWasRequiredFromSnapshot
? path.join(resourcePath, 'node_modules', 'symbols-view')
? path.join(resourcePath, 'node_modules', 'symbol-provider-ctags')
: path.resolve(__dirname, '..');
if (path.extname(resourcePath) === '.asar' && packageRoot.indexOf(resourcePath) === 0) {
return path.join(`${resourcePath}.unpacked`, 'node_modules', 'symbols-view');
return path.join(`${resourcePath}.unpacked`, 'node_modules', 'symbol-provider-ctags');
} else {
return packageRoot;
}

View File

@ -52,6 +52,14 @@ describe('CTagsProvider', () => {
);
});
it('identifies its project root correctly', () => {
let root = provider.getPackageRoot();
expect(root).toContain("symbol-provider-ctags");
expect(
fs.existsSync(path.join(root, "vendor", "ctags-darwin"))
).toBe(true);
});
describe('when tags can be generated for a file', () => {
beforeEach(async () => {
await atom.workspace.open(directory.resolve('sample.js'));