@herb-tools/language-server 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -0
- package/LICENSE.txt +21 -0
- package/README.md +33 -0
- package/dist/config.js +80 -0
- package/dist/config.js.map +1 -0
- package/dist/diagnostics.js +72 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/document_service.js +30 -0
- package/dist/document_service.js.map +1 -0
- package/dist/herb-language-server +20526 -0
- package/dist/herb-language-server.js +20525 -0
- package/dist/herb-language-server.js.map +1 -0
- package/dist/project.js +18 -0
- package/dist/project.js.map +1 -0
- package/dist/server.js +70 -0
- package/dist/server.js.map +1 -0
- package/dist/service.js +39 -0
- package/dist/service.js.map +1 -0
- package/dist/settings.js +46 -0
- package/dist/settings.js.map +1 -0
- package/dist/types/config.d.ts +26 -0
- package/dist/types/diagnostics.d.ts +15 -0
- package/dist/types/document_service.d.ts +12 -0
- package/dist/types/project.d.ts +8 -0
- package/dist/types/server.d.ts +1 -0
- package/dist/types/service.d.ts +18 -0
- package/dist/types/settings.d.ts +17 -0
- package/dist/types/utils.d.ts +3 -0
- package/dist/utils.js +15 -0
- package/dist/utils.js.map +1 -0
- package/package.json +46 -0
package/CHANGELOG.md
ADDED
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Marco Roth
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Herb Language Server (`@herb-tools/language-server`)
|
|
2
|
+
|
|
3
|
+
[Language Server Protocol](https://github.com/Microsoft/language-server-protocol) integration for HTML-aware ERB using the [Herb Parser](https://herb-tools.dev).
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
Used by the [Herb LSP](https://marketplace.visualstudio.com/items?itemName=marcoroth.herb-lsp) Visual Studio Code extension.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install -g herb-language-server
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
yarn global add herb-language-server
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Run
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
herb-language-server --stdio
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
Usage: herb-language-server [options]
|
|
27
|
+
|
|
28
|
+
Options:
|
|
29
|
+
|
|
30
|
+
--stdio use stdio
|
|
31
|
+
--node-ipc use node-ipc
|
|
32
|
+
--socket=<port> use socket
|
|
33
|
+
```
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Config = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const package_json_1 = require("../package.json");
|
|
9
|
+
const fs_1 = require("fs");
|
|
10
|
+
class Config {
|
|
11
|
+
constructor(projectPath, config) {
|
|
12
|
+
this.path = Config.configPathFromProjectPath(projectPath);
|
|
13
|
+
this.config = config;
|
|
14
|
+
}
|
|
15
|
+
get version() {
|
|
16
|
+
return this.config.version;
|
|
17
|
+
}
|
|
18
|
+
get createdAt() {
|
|
19
|
+
return new Date(this.config.createdAt);
|
|
20
|
+
}
|
|
21
|
+
get updatedAt() {
|
|
22
|
+
return new Date(this.config.updatedAt);
|
|
23
|
+
}
|
|
24
|
+
get options() {
|
|
25
|
+
return this.config.options;
|
|
26
|
+
}
|
|
27
|
+
toJSON() {
|
|
28
|
+
return JSON.stringify(this.config, null, " ");
|
|
29
|
+
}
|
|
30
|
+
updateTimestamp() {
|
|
31
|
+
this.config.updatedAt = new Date().toISOString();
|
|
32
|
+
}
|
|
33
|
+
updateVersion() {
|
|
34
|
+
this.config.version = package_json_1.version;
|
|
35
|
+
}
|
|
36
|
+
async write() {
|
|
37
|
+
this.updateVersion();
|
|
38
|
+
this.updateTimestamp();
|
|
39
|
+
const folder = path_1.default.dirname(this.path);
|
|
40
|
+
fs_1.promises.stat(folder)
|
|
41
|
+
.then(() => { })
|
|
42
|
+
.catch(async () => await fs_1.promises.mkdir(folder))
|
|
43
|
+
.finally(async () => await fs_1.promises.writeFile(this.path, this.toJSON()));
|
|
44
|
+
}
|
|
45
|
+
async read() {
|
|
46
|
+
return await fs_1.promises.readFile(this.path, "utf8");
|
|
47
|
+
}
|
|
48
|
+
static configPathFromProjectPath(projectPath) {
|
|
49
|
+
return path_1.default.join(projectPath, this.configPath);
|
|
50
|
+
}
|
|
51
|
+
static async fromPathOrNew(projectPath) {
|
|
52
|
+
try {
|
|
53
|
+
return await this.fromPath(projectPath);
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
return Config.newConfig(projectPath);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
static async fromPath(projectPath) {
|
|
60
|
+
const configPath = Config.configPathFromProjectPath(projectPath);
|
|
61
|
+
try {
|
|
62
|
+
const config = JSON.parse(await fs_1.promises.readFile(configPath, "utf8"));
|
|
63
|
+
return new Config(projectPath, config);
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
throw new Error(`Error reading config file at: ${configPath}. Error: ${error.message}`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
static newConfig(projectPath) {
|
|
70
|
+
return new Config(projectPath, {
|
|
71
|
+
version: package_json_1.version,
|
|
72
|
+
createdAt: new Date().toISOString(),
|
|
73
|
+
updatedAt: new Date().toISOString(),
|
|
74
|
+
options: {}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.Config = Config;
|
|
79
|
+
Config.configPath = ".herb-lsp/config.json";
|
|
80
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;;AASA,gDAAuB;AACvB,kDAAyC;AACzC,2BAAmC;AAEnC,MAAa,MAAM;IAMjB,YAAY,WAAmB,EAAE,MAAqB;QACpD,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,yBAAyB,CAAC,WAAW,CAAC,CAAA;QACzD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAA;IAC5B,CAA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
exports.Diagnostics = void 0;
|
|
4
|
+
const node_1 = require("vscode-languageserver/node");
|
|
5
|
+
const node_wasm_1 = require("@herb-tools/node-wasm");
|
|
6
|
+
class ErrorVisitor extends node_wasm_1.Visitor {
|
|
7
|
+
constructor(diagnostics, textDocument) {
|
|
8
|
+
super();
|
|
9
|
+
this.diagnostics = diagnostics;
|
|
10
|
+
this.textDocument = textDocument;
|
|
11
|
+
}
|
|
12
|
+
visitChildNodes(node) {
|
|
13
|
+
super.visitChildNodes(node);
|
|
14
|
+
node.errors.forEach(error => this.publishDiagnosticForError(error, node));
|
|
15
|
+
}
|
|
16
|
+
publishDiagnosticForError(error, node) {
|
|
17
|
+
this.diagnostics.pushDiagnostic(error.message, error.type, this.rangeFromHerbError(error), this.textDocument, {
|
|
18
|
+
error: error.toJSON(),
|
|
19
|
+
node: node.toJSON()
|
|
20
|
+
}, node_1.DiagnosticSeverity.Error);
|
|
21
|
+
}
|
|
22
|
+
rangeFromHerbError(error) {
|
|
23
|
+
return node_1.Range.create(node_1.Position.create(error.location.start.line - 1, error.location.start.column), node_1.Position.create(error.location.end.line - 1, error.location.end.column));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
class Diagnostics {
|
|
27
|
+
constructor(connection, documentService) {
|
|
28
|
+
this.diagnosticsSource = "Herb LSP ";
|
|
29
|
+
this.diagnostics = new Map();
|
|
30
|
+
this.connection = connection;
|
|
31
|
+
this.documentService = documentService;
|
|
32
|
+
}
|
|
33
|
+
validate(textDocument) {
|
|
34
|
+
const content = textDocument.getText();
|
|
35
|
+
const result = node_wasm_1.Herb.parse(content);
|
|
36
|
+
const visitor = new ErrorVisitor(this, textDocument);
|
|
37
|
+
result.visit(visitor);
|
|
38
|
+
this.sendDiagnosticsFor(textDocument);
|
|
39
|
+
}
|
|
40
|
+
refreshDocument(document) {
|
|
41
|
+
this.validate(document);
|
|
42
|
+
}
|
|
43
|
+
refreshAllDocuments() {
|
|
44
|
+
this.documentService.getAll().forEach((document) => {
|
|
45
|
+
this.refreshDocument(document);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
pushDiagnostic(message, code, range, textDocument, data = {}, severity = node_1.DiagnosticSeverity.Error) {
|
|
49
|
+
const diagnostic = {
|
|
50
|
+
source: this.diagnosticsSource,
|
|
51
|
+
severity,
|
|
52
|
+
range,
|
|
53
|
+
message,
|
|
54
|
+
code,
|
|
55
|
+
data,
|
|
56
|
+
};
|
|
57
|
+
const diagnostics = this.diagnostics.get(textDocument) || [];
|
|
58
|
+
diagnostics.push(diagnostic);
|
|
59
|
+
this.diagnostics.set(textDocument, diagnostics);
|
|
60
|
+
return diagnostic;
|
|
61
|
+
}
|
|
62
|
+
sendDiagnosticsFor(textDocument) {
|
|
63
|
+
const diagnostics = this.diagnostics.get(textDocument) || [];
|
|
64
|
+
this.connection.sendDiagnostics({
|
|
65
|
+
uri: textDocument.uri,
|
|
66
|
+
diagnostics,
|
|
67
|
+
});
|
|
68
|
+
this.diagnostics.delete(textDocument);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.Diagnostics = Diagnostics;
|
|
72
|
+
//# sourceMappingURL=diagnostics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":";;;AAAA,qDAAwG;AAExG,qDAAqD;AAMrD,MAAM,YAAa,SAAQ,mBAAO;IAIhC,YAAY,WAAwB,EAAE,YAA0B;QAC9D,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAC9B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;IAClC,CAAC;IAED,eAAe,CAAC,IAAU;QACxB,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,CAAA;QAE3B,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,IAAI,CAAC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: true });
|
|
3
|
+
exports.DocumentService = void 0;
|
|
4
|
+
const node_1 = require("vscode-languageserver/node");
|
|
5
|
+
const vscode_languageserver_textdocument_1 = require("vscode-languageserver-textdocument");
|
|
6
|
+
class DocumentService {
|
|
7
|
+
constructor(connection) {
|
|
8
|
+
this.documents = new node_1.TextDocuments(vscode_languageserver_textdocument_1.TextDocument);
|
|
9
|
+
// Make the text document manager listen on the connection
|
|
10
|
+
// for open, change and close text document events
|
|
11
|
+
this.documents.listen(connection);
|
|
12
|
+
}
|
|
13
|
+
get(uri) {
|
|
14
|
+
return this.documents.get(uri);
|
|
15
|
+
}
|
|
16
|
+
getAll() {
|
|
17
|
+
return this.documents.all();
|
|
18
|
+
}
|
|
19
|
+
get onDidChangeContent() {
|
|
20
|
+
return this.documents.onDidChangeContent;
|
|
21
|
+
}
|
|
22
|
+
get onDidOpen() {
|
|
23
|
+
return this.documents.onDidOpen;
|
|
24
|
+
}
|
|
25
|
+
get onDidClose() {
|
|
26
|
+
return this.documents.onDidClose;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.DocumentService = DocumentService;
|
|
30
|
+
//# sourceMappingURL=document_service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document_service.js","sourceRoot":"","sources":["../src/document_service.ts"],"names":[],"mappings":";;;AAAA,qDAAsE;AACtE,2FAAiE;AAEjE,MAAa,eAAe;IAI1B,YAAY,UAAsB;QAChC,IAAI,CAAC,SAAS,GAAG,IAAI,oBAAa,CAAC,iDAAY,CAAC,CAAA;QAEhD,0DAA0D;QAC1D,kDAAkD;QAClD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;IACnC,CAAC;IAED,GAAG,CAAC,GAAW;QACb,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAChC,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAA;IAC7B,CAAC;IAED,IAAI,kBAAkB;QACpB,OAAO,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAA;IAC1C,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAA;IACjC,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAA;IAClC,CAAC;CACF;AA/BD,0CA+BC"}
|