New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bash-language-server

Package Overview
Dependencies
Maintainers
1
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bash-language-server - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

bin/main.js

197

out/server.js

@@ -1,106 +0,107 @@

'use strict';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const vscode_languageserver_1 = require("vscode-languageserver");
const glob = require('glob');
const fs = require('fs');
const glob = require("glob");
const fs = require("fs");
const Path = require("path");
const Analyser = require("./analyser");
// Create a connection for the server.
// The connection uses stdin/stdout for communication.
const connection = vscode_languageserver_1.createConnection(new vscode_languageserver_1.StreamMessageReader(process.stdin), new vscode_languageserver_1.StreamMessageWriter(process.stdout));
// Create a simple text document manager. The text document manager
// supports full document sync only
const documents = new vscode_languageserver_1.TextDocuments();
// Make the text document manager listen on the connection
// for open, change and close text document events
documents.listen(connection);
connection.onInitialize((params) => {
connection.console.log(`Initialized for ${params.rootUri}, ${params.rootPath}`);
glob("**/*.sh", { cwd: params.rootPath, }, (err, paths) => {
if (err != null) {
connection.console.error(err);
}
else {
paths.forEach(p => {
const absolute = Path.join(params.rootPath, p);
const uri = 'file://' + absolute;
connection.console.log('Analyzing ' + uri);
Analyser.analyze(uri, fs.readFileSync(absolute, 'utf8'));
});
}
});
return {
capabilities: {
// For now we're using full-sync even though tree-sitter has great support
// for partial updates.
textDocumentSync: documents.syncKind,
completionProvider: {
resolveProvider: true
},
documentHighlightProvider: true,
definitionProvider: true,
documentSymbolProvider: true,
referencesProvider: true
}
};
});
// The content of a text document has changed. This event is emitted
// when the text document first opened or when its content has changed.
documents.onDidChangeContent((change) => {
connection.console.log('Invoked onDidChangeContent');
const uri = change.document.uri;
const contents = change.document.getText();
const diagnostics = Analyser.analyze(uri, contents);
connection.sendDiagnostics({
uri: change.document.uri,
diagnostics
});
});
connection.onDidChangeWatchedFiles((_change) => {
// Monitored files have change in VSCode
connection.console.log('We received an file change event');
});
connection.onDefinition((textDocumentPosition) => {
connection.console.log(`Asked for definition at ${textDocumentPosition.position.line}:${textDocumentPosition.position.character}`);
const word = Analyser.wordAtPoint(textDocumentPosition.textDocument.uri, textDocumentPosition.position.line, textDocumentPosition.position.character);
return Analyser.findDefinition(word);
});
connection.onDocumentSymbol((params) => {
return Analyser.findSymbols(params.textDocument.uri);
});
connection.onDocumentHighlight((textDocumentPosition) => {
const word = Analyser.wordAtPoint(textDocumentPosition.textDocument.uri, textDocumentPosition.position.line, textDocumentPosition.position.character);
return Analyser
.findOccurrences(textDocumentPosition.textDocument.uri, word)
.map(n => ({ range: n.range }));
});
connection.onReferences((params) => {
const word = Analyser.wordAtPoint(params.textDocument.uri, params.position.line, params.position.character);
return Analyser.findReferences(word);
});
connection.onCompletion((textDocumentPosition) => {
connection.console.log(`Asked for completions at ${textDocumentPosition.position.line}:${textDocumentPosition.position.character}`);
const symbols = Analyser.findSymbols(textDocumentPosition.textDocument.uri);
return symbols.map((s) => {
function listen() {
// Create a connection for the server.
// The connection uses stdin/stdout for communication.
const connection = vscode_languageserver_1.createConnection(new vscode_languageserver_1.StreamMessageReader(process.stdin), new vscode_languageserver_1.StreamMessageWriter(process.stdout));
// Create a simple text document manager. The text document manager
// supports full document sync only
const documents = new vscode_languageserver_1.TextDocuments();
// Make the text document manager listen on the connection
// for open, change and close text document events
documents.listen(connection);
connection.onInitialize((params) => {
connection.console.log(`Initialized for ${params.rootUri}, ${params.rootPath}`);
glob("**/*.sh", { cwd: params.rootPath }, (err, paths) => {
if (err != null) {
connection.console.error(err);
}
else {
paths.forEach(p => {
const absolute = Path.join(params.rootPath, p);
const uri = "file://" + absolute;
connection.console.log("Analyzing " + uri);
Analyser.analyze(uri, fs.readFileSync(absolute, "utf8"));
});
}
});
return {
label: s.name,
kind: s.kind,
data: s.name // Used for later resolving more info.
capabilities: {
// For now we're using full-sync even though tree-sitter has great support
// for partial updates.
textDocumentSync: documents.syncKind,
completionProvider: {
resolveProvider: true
},
documentHighlightProvider: true,
definitionProvider: true,
documentSymbolProvider: true,
referencesProvider: true
}
};
});
});
// This handler resolve additional information for the item selected in
// the completion list.
connection.onCompletionResolve((item) => {
// TODO: Look up man pages for commands
// TODO: For builtins look up the docs.
// TODO: For functions, parse their comments?
// if (item.data === 1) {
// item.detail = 'TypeScript details',
// item.documentation = 'TypeScript documentation'
// }
return item;
});
// Listen on the connection
connection.listen();
// The content of a text document has changed. This event is emitted
// when the text document first opened or when its content has changed.
documents.onDidChangeContent(change => {
connection.console.log("Invoked onDidChangeContent");
const uri = change.document.uri;
const contents = change.document.getText();
const diagnostics = Analyser.analyze(uri, contents);
connection.sendDiagnostics({
uri: change.document.uri,
diagnostics
});
});
connection.onDidChangeWatchedFiles(_change => {
// Monitored files have change in VSCode
connection.console.log("We received an file change event");
});
connection.onDefinition((textDocumentPosition) => {
connection.console.log(`Asked for definition at ${textDocumentPosition.position.line}:${textDocumentPosition.position.character}`);
const word = Analyser.wordAtPoint(textDocumentPosition.textDocument.uri, textDocumentPosition.position.line, textDocumentPosition.position.character);
return Analyser.findDefinition(word);
});
connection.onDocumentSymbol((params) => {
return Analyser.findSymbols(params.textDocument.uri);
});
connection.onDocumentHighlight((textDocumentPosition) => {
const word = Analyser.wordAtPoint(textDocumentPosition.textDocument.uri, textDocumentPosition.position.line, textDocumentPosition.position.character);
return Analyser.findOccurrences(textDocumentPosition.textDocument.uri, word).map(n => ({ range: n.range }));
});
connection.onReferences((params) => {
const word = Analyser.wordAtPoint(params.textDocument.uri, params.position.line, params.position.character);
return Analyser.findReferences(word);
});
connection.onCompletion((textDocumentPosition) => {
connection.console.log(`Asked for completions at ${textDocumentPosition.position.line}:${textDocumentPosition.position.character}`);
const symbols = Analyser.findSymbols(textDocumentPosition.textDocument.uri);
return symbols.map((s) => {
return {
label: s.name,
kind: s.kind,
data: s.name // Used for later resolving more info.
};
});
});
// This handler resolve additional information for the item selected in
// the completion list.
connection.onCompletionResolve((item) => {
// TODO: Look up man pages for commands
// TODO: For builtins look up the docs.
// TODO: For functions, parse their comments?
// if (item.data === 1) {
// item.detail = 'TypeScript details',
// item.documentation = 'TypeScript documentation'
// }
return item;
});
// Listen on the connection
connection.listen();
}
exports.listen = listen;
//# sourceMappingURL=server.js.map

@@ -6,5 +6,8 @@ {

"license": "MIT",
"version": "1.0.0",
"version": "1.1.0",
"publisher": "mads-hartmann",
"main": "out/server.js",
"bin": {
"bash-language-server": "./bin/main.js"
},
"repository": {

@@ -19,15 +22,10 @@ "type": "git",

"glob": "^7.1.2",
"tree-sitter": "^0.9.2",
"tree-sitter-bash": "^0.5.5",
"vscode-languageserver": "^3.5.0"
},
"devDependencies": {
"tree-sitter-bash": "^0.5.5",
"tree-sitter": "^0.9.2"
},
"peerDependencies": {
"tree-sitter-bash": "^0.5.5",
"tree-sitter": "^0.9.2"
},
"scripts": {
"build": "tsc"
"compile": "tsc -p ./",
"compile:watch": "tsc -w -p ./"
}
}

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -10,3 +10,3 @@ import {

CompletionItem,
Definition,
Definition,
StreamMessageReader,

@@ -18,140 +18,161 @@ StreamMessageWriter,

DocumentHighlight,
ReferenceParams} from 'vscode-languageserver';
ReferenceParams
} from "vscode-languageserver";
const glob = require('glob')
const fs = require('fs')
import * as Path from 'path'
import * as Analyser from './analyser';
const glob = require("glob");
const fs = require("fs");
import * as Path from "path";
// Create a connection for the server.
// The connection uses stdin/stdout for communication.
const connection: IConnection = createConnection(
new StreamMessageReader(process.stdin),
new StreamMessageWriter(process.stdout)
);
import * as Analyser from "./analyser";
// Create a simple text document manager. The text document manager
// supports full document sync only
const documents: TextDocuments = new TextDocuments();
export function listen() {
// Create a connection for the server.
// The connection uses stdin/stdout for communication.
const connection: IConnection = createConnection(
new StreamMessageReader(process.stdin),
new StreamMessageWriter(process.stdout)
);
// Make the text document manager listen on the connection
// for open, change and close text document events
documents.listen(connection);
// Create a simple text document manager. The text document manager
// supports full document sync only
const documents: TextDocuments = new TextDocuments();
connection.onInitialize((params): InitializeResult => {
connection.console.log(`Initialized for ${params.rootUri}, ${params.rootPath}`)
// Make the text document manager listen on the connection
// for open, change and close text document events
documents.listen(connection);
glob(
"**/*.sh",
{cwd: params.rootPath, },
(err, paths) => {
connection.onInitialize((params): InitializeResult => {
connection.console.log(
`Initialized for ${params.rootUri}, ${params.rootPath}`
);
glob("**/*.sh", { cwd: params.rootPath }, (err, paths) => {
if (err != null) {
connection.console.error(err)
connection.console.error(err);
} else {
paths.forEach(p => {
const absolute = Path.join(params.rootPath, p)
const uri = 'file://' + absolute
connection.console.log('Analyzing ' + uri)
Analyser.analyze(uri, fs.readFileSync(absolute, 'utf8'))
})
const absolute = Path.join(params.rootPath, p);
const uri = "file://" + absolute;
connection.console.log("Analyzing " + uri);
Analyser.analyze(uri, fs.readFileSync(absolute, "utf8"));
});
}
}
)
});
return {
capabilities: {
// For now we're using full-sync even though tree-sitter has great support
// for partial updates.
textDocumentSync: documents.syncKind,
completionProvider: {
resolveProvider: true
},
documentHighlightProvider: true,
definitionProvider: true,
documentSymbolProvider: true,
referencesProvider: true
}
}
});
return {
capabilities: {
// For now we're using full-sync even though tree-sitter has great support
// for partial updates.
textDocumentSync: documents.syncKind,
completionProvider: {
resolveProvider: true
},
documentHighlightProvider: true,
definitionProvider: true,
documentSymbolProvider: true,
referencesProvider: true
}
};
});
// The content of a text document has changed. This event is emitted
// when the text document first opened or when its content has changed.
documents.onDidChangeContent((change) => {
connection.console.log('Invoked onDidChangeContent');
const uri = change.document.uri
const contents = change.document.getText();
const diagnostics = Analyser.analyze(uri, contents)
connection.sendDiagnostics({
uri: change.document.uri,
diagnostics
})
});
// The content of a text document has changed. This event is emitted
// when the text document first opened or when its content has changed.
documents.onDidChangeContent(change => {
connection.console.log("Invoked onDidChangeContent");
const uri = change.document.uri;
const contents = change.document.getText();
const diagnostics = Analyser.analyze(uri, contents);
connection.sendDiagnostics({
uri: change.document.uri,
diagnostics
});
});
connection.onDidChangeWatchedFiles((_change) => {
// Monitored files have change in VSCode
connection.console.log('We received an file change event');
});
connection.onDidChangeWatchedFiles(_change => {
// Monitored files have change in VSCode
connection.console.log("We received an file change event");
});
connection.onDefinition((textDocumentPosition: TextDocumentPositionParams): Definition => {
connection.console.log(`Asked for definition at ${textDocumentPosition.position.line}:${textDocumentPosition.position.character}`);
const word = Analyser.wordAtPoint(
textDocumentPosition.textDocument.uri,
textDocumentPosition.position.line,
textDocumentPosition.position.character
)
return Analyser.findDefinition(word);
});
connection.onDefinition(
(textDocumentPosition: TextDocumentPositionParams): Definition => {
connection.console.log(
`Asked for definition at ${textDocumentPosition.position.line}:${
textDocumentPosition.position.character
}`
);
const word = Analyser.wordAtPoint(
textDocumentPosition.textDocument.uri,
textDocumentPosition.position.line,
textDocumentPosition.position.character
);
return Analyser.findDefinition(word);
}
);
connection.onDocumentSymbol((params: DocumentSymbolParams): SymbolInformation[] => {
return Analyser.findSymbols(params.textDocument.uri)
})
connection.onDocumentSymbol(
(params: DocumentSymbolParams): SymbolInformation[] => {
return Analyser.findSymbols(params.textDocument.uri);
}
);
connection.onDocumentHighlight((textDocumentPosition: TextDocumentPositionParams): DocumentHighlight[] => {
const word = Analyser.wordAtPoint(
textDocumentPosition.textDocument.uri,
textDocumentPosition.position.line,
textDocumentPosition.position.character
)
return Analyser
.findOccurrences(textDocumentPosition.textDocument.uri, word)
.map(n => ({range: n.range}))
})
connection.onDocumentHighlight(
(textDocumentPosition: TextDocumentPositionParams): DocumentHighlight[] => {
const word = Analyser.wordAtPoint(
textDocumentPosition.textDocument.uri,
textDocumentPosition.position.line,
textDocumentPosition.position.character
);
return Analyser.findOccurrences(
textDocumentPosition.textDocument.uri,
word
).map(n => ({ range: n.range }));
}
);
connection.onReferences((params: ReferenceParams): Location[] => {
const word = Analyser.wordAtPoint(
params.textDocument.uri,
params.position.line,
params.position.character
)
return Analyser.findReferences(word)
})
connection.onReferences((params: ReferenceParams): Location[] => {
const word = Analyser.wordAtPoint(
params.textDocument.uri,
params.position.line,
params.position.character
);
return Analyser.findReferences(word);
});
connection.onCompletion((textDocumentPosition: TextDocumentPositionParams): CompletionItem[] => {
connection.console.log(`Asked for completions at ${textDocumentPosition.position.line}:${textDocumentPosition.position.character}`);
const symbols = Analyser.findSymbols(textDocumentPosition.textDocument.uri)
return symbols.map((s: SymbolInformation) => {
return {
label: s.name,
kind: s.kind,
data: s.name // Used for later resolving more info.
connection.onCompletion(
(textDocumentPosition: TextDocumentPositionParams): CompletionItem[] => {
connection.console.log(
`Asked for completions at ${textDocumentPosition.position.line}:${
textDocumentPosition.position.character
}`
);
const symbols = Analyser.findSymbols(
textDocumentPosition.textDocument.uri
);
return symbols.map((s: SymbolInformation) => {
return {
label: s.name,
kind: s.kind,
data: s.name // Used for later resolving more info.
};
});
}
})
});
);
// This handler resolve additional information for the item selected in
// the completion list.
connection.onCompletionResolve((item: CompletionItem): CompletionItem => {
// TODO: Look up man pages for commands
// TODO: For builtins look up the docs.
// TODO: For functions, parse their comments?
// This handler resolve additional information for the item selected in
// the completion list.
connection.onCompletionResolve((item: CompletionItem): CompletionItem => {
// TODO: Look up man pages for commands
// TODO: For builtins look up the docs.
// TODO: For functions, parse their comments?
// if (item.data === 1) {
// item.detail = 'TypeScript details',
// item.documentation = 'TypeScript documentation'
// }
// if (item.data === 1) {
// item.detail = 'TypeScript details',
// item.documentation = 'TypeScript documentation'
// }
return item;
});
return item;
});
// Listen on the connection
connection.listen();
// Listen on the connection
connection.listen();
}

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