Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@elastic/ctags-langserver

Package Overview
Dependencies
Maintainers
62
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@elastic/ctags-langserver - npm Package Compare versions

Comparing version 0.1.8 to 0.1.9

2

lib/lsp-server.d.ts

@@ -15,2 +15,3 @@ import { InitializeParams, InitializeResult, DidChangeWorkspaceFoldersParams, DocumentSymbolParams, TextDocumentPositionParams, Hover, Location, ReferenceParams, DocumentSymbol } from 'vscode-languageserver-protocol';

readonly tagFileName = "tags";
readonly tmpTagName = "tags.tmp";
constructor(options: IServerOptions);

@@ -28,3 +29,4 @@ initialize(params: InitializeParams): Promise<InitializeResult>;

private runCtags;
private runCtagsOnSingleFile;
protected findCtagsPath(): string;
}

@@ -64,2 +64,3 @@ "use strict";

this.tagFileName = 'tags';
this.tmpTagName = 'tags.tmp';
this.logger = new logger_1.PrefixingLogger(options.logger, '[lspserver]');

@@ -240,3 +241,4 @@ }

const relativePath = path.relative(rootPath, filePath);
const stream = ctags.createReadStream(path.resolve(rootPath, this.tagFileName));
this.runCtagsOnSingleFile(rootPath, relativePath);
const stream = ctags.createReadStream(path.resolve(rootPath, this.tmpTagName));
return new Promise(resolve => {

@@ -247,4 +249,3 @@ let results = [];

// @ts-ignore
const definitions = tags.filter(tag => path.normalize(tag.file) === path.normalize(relativePath));
for (let def of definitions) {
for (let def of tags) {
let symbolInformation = vscode_languageserver_protocol_1.SymbolInformation.create(def.name, vscode_languageserver_protocol_1.SymbolKind.Method, vscode_languageserver_protocol_1.Range.create(vscode_languageserver_protocol_1.Position.create(def.lineNumber - 1, 0), vscode_languageserver_protocol_1.Position.create(def.lineNumber - 1, 0)), unitURI, relativePath);

@@ -350,4 +351,5 @@ if (def.fields !== undefined) {

const ctagsPath = this.findCtagsPath();
const excludeCommands = utils_1.getGitIgnored(rootPath).map(pattern => `--exclude=${pattern}`).join(' ');
try {
child_process_1.execSync(`${ctagsPath} --fields=-anf+iKnS --languages=${CTAGS_SUPPORT_LANGS.join(',')} -R .`, { cwd: rootPath, stdio: 'pipe' });
child_process_1.execSync(`${ctagsPath} --fields=-anf+iKnS --languages=${CTAGS_SUPPORT_LANGS.join(',')} ${excludeCommands} -R`, { cwd: rootPath, stdio: 'pipe' });
}

@@ -367,2 +369,20 @@ catch (err) {

}
runCtagsOnSingleFile(rootPath, filePath) {
const ctagsPath = this.findCtagsPath();
try {
child_process_1.execSync(`${ctagsPath} --fields=-anf+iKnS -f ${this.tmpTagName} ${filePath}`, { cwd: rootPath, stdio: 'pipe' });
}
catch (err) {
this.logger.error(`Fail to run ctags command with exit code ${err.status}`);
this.logger.error(`${err.stderr}`);
}
try {
if (!fs_1.existsSync(path.resolve(rootPath, this.tmpTagName))) {
this.logger.error(`Cannot find tag file in ${path.resolve(rootPath, this.tmpTagName)}`);
}
}
catch (err) {
this.logger.error(err);
}
}
findCtagsPath() {

@@ -369,0 +389,0 @@ if (this.options.ctagsPath) {

@@ -13,2 +13,3 @@ import { DocumentSymbol, SymbolInformation } from 'vscode-languageserver';

}
export declare function getGitIgnored(rootPath: string): string[];
export {};

@@ -26,2 +26,4 @@ "use strict";

const line_column_1 = __importDefault(require("line-column"));
// @ts-ignore
const parse_gitignore_1 = __importDefault(require("parse-gitignore"));
const WORD_CHAR = /(\w)/;

@@ -169,2 +171,11 @@ function getOffsetOfLineAndCharacter(sourceFile, line, character) {

exports.toHierarchicalDocumentSymbol = toHierarchicalDocumentSymbol;
function getGitIgnored(rootPath) {
if (fs.existsSync(path.resolve(rootPath, '.gitignore'))) {
return parse_gitignore_1.default(fs.readFileSync(path.resolve(rootPath, '.gitignore')));
}
else {
return [];
}
}
exports.getGitIgnored = getGitIgnored;
//# sourceMappingURL=utils.js.map

5

package.json
{
"name": "@elastic/ctags-langserver",
"version": "0.1.8",
"version": "0.1.9",
"description": "An all-languages language server built on top of ctags",

@@ -34,2 +34,3 @@ "author": "Elastic",

"mz": "^2.7.0",
"parse-gitignore": "1.0.1",
"vscode-languageserver": "^5.2.1"

@@ -43,3 +44,3 @@ },

"@types/node": "^12.0.4",
"jest": "^24.8.0",
"jest": "^24.9.0",
"ts-jest": "^24.0.2",

@@ -46,0 +47,0 @@ "ts-node": "7.0.1",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc