mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-08-16 14:40:23 +03:00
Fix issue where symbol-provider-ctags
used the wrong package root
This commit is contained in:
parent
865153b471
commit
ddfa645122
@ -62,11 +62,11 @@ class CtagsProvider {
|
|||||||
const {resourcePath} = atom.getLoadSettings();
|
const {resourcePath} = atom.getLoadSettings();
|
||||||
const currentFileWasRequiredFromSnapshot = !fs.isAbsolute(__dirname);
|
const currentFileWasRequiredFromSnapshot = !fs.isAbsolute(__dirname);
|
||||||
const packageRoot = currentFileWasRequiredFromSnapshot
|
const packageRoot = currentFileWasRequiredFromSnapshot
|
||||||
? path.join(resourcePath, 'node_modules', 'symbols-view')
|
? path.join(resourcePath, 'node_modules', 'symbol-provider-ctags')
|
||||||
: path.resolve(__dirname, '..');
|
: path.resolve(__dirname, '..');
|
||||||
|
|
||||||
if (path.extname(resourcePath) === '.asar' && packageRoot.indexOf(resourcePath) === 0) {
|
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 {
|
} else {
|
||||||
return packageRoot;
|
return packageRoot;
|
||||||
}
|
}
|
||||||
|
@ -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', () => {
|
describe('when tags can be generated for a file', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await atom.workspace.open(directory.resolve('sample.js'));
|
await atom.workspace.open(directory.resolve('sample.js'));
|
||||||
|
Loading…
Reference in New Issue
Block a user