rintenki-lsp-server 0.2.0 → 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.
Files changed (2) hide show
  1. package/dist/server.js +9 -2
  2. package/package.json +2 -2
package/dist/server.js CHANGED
@@ -28,6 +28,8 @@ connection.onInitialized(() => {
28
28
  if (settings?.rules) {
29
29
  config = { rules: settings.rules };
30
30
  }
31
+ // Re-validate all open documents after config is loaded
32
+ documents.all().forEach(validateDocument);
31
33
  }, () => {
32
34
  // Configuration not available, use defaults
33
35
  });
@@ -55,10 +57,13 @@ function toDiagnosticSeverity(severity) {
55
57
  }
56
58
  function toLspDiagnostic(d) {
57
59
  const line = Math.max((d.line ?? 1) - 1, 0);
60
+ const startChar = d.col ?? 0;
61
+ const endLine = d.endLine != null ? Math.max(d.endLine - 1, 0) : line;
62
+ const endChar = d.endCol ?? Number.MAX_SAFE_INTEGER;
58
63
  return {
59
64
  range: {
60
- start: { line, character: 0 },
61
- end: { line, character: Number.MAX_SAFE_INTEGER },
65
+ start: { line, character: startChar },
66
+ end: { line: endLine, character: endChar },
62
67
  },
63
68
  severity: toDiagnosticSeverity(d.severity),
64
69
  source: "rintenki",
@@ -93,6 +98,8 @@ function validateDocument(document) {
93
98
  for (const d of result.diagnostics) {
94
99
  if (d.line != null)
95
100
  d.line += lineOffset;
101
+ if (d.endLine != null)
102
+ d.endLine += lineOffset;
96
103
  }
97
104
  }
98
105
  const diagnostics = result.diagnostics.map(toLspDiagnostic);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rintenki-lsp-server",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "LSP server for rintenki HTML linter",
5
5
  "author": "Kazuhiro Kobayashi <https://github.com/kzhrk>",
6
6
  "license": "MIT",
@@ -26,7 +26,7 @@
26
26
  "dependencies": {
27
27
  "vscode-languageserver": "9.0.1",
28
28
  "vscode-languageserver-textdocument": "1.0.12",
29
- "rintenki": "0.2.0"
29
+ "rintenki": "0.3.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "typescript": "6.0.2"