@markuplint/language-server 5.5.0 → 5.6.1

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.
@@ -1,3 +1,4 @@
1
+ import { searchNodeAtLocation } from '@markuplint/ml-core';
1
2
  export async function getAccessibilityByLocation(
2
3
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
3
4
  engine, line, col, ariaVersion) {
@@ -7,7 +8,10 @@ engine, line, col, ariaVersion) {
7
8
  if (!engine?.document) {
8
9
  return null;
9
10
  }
10
- const node = engine.document.searchNodeByLocation(line, col);
11
+ // The engine is the markuplint the user installed, whose `searchNodeByLocation` may be of an older
12
+ // version (one that compared the line and the column apart and took the end of a range in), so the
13
+ // node list is searched here, by the rule of this version.
14
+ const node = searchNodeAtLocation(engine.document.nodeList, line, col);
11
15
  if (!node || !node.is(node.ELEMENT_NODE)) {
12
16
  return null;
13
17
  }
package/lib/server/v3.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import path from 'node:path';
2
+ import { searchNodeAtLocation } from '@markuplint/ml-core';
2
3
  import { getFilePath } from '../utils/get-file-path.js';
3
4
  import { convertDiagnostics } from './convert-diagnostics.js';
4
5
  const engines = new Map();
@@ -163,7 +164,10 @@ position, ariaVersion) {
163
164
  if (!engine || !engine.document) {
164
165
  return null;
165
166
  }
166
- const node = engine.document.searchNodeByLocation(position.line + 1, position.character);
167
+ // LSP counts the character from 0, the node list the column from 1. The engine is the user's
168
+ // markuplint v3, whose `searchNodeByLocation` takes the end of a range in and compares the line
169
+ // and the column apart, so the node list is searched by the rule of this version.
170
+ const node = searchNodeAtLocation(engine.document.nodeList, position.line + 1, position.character + 1);
167
171
  if (!node || !node.is(node.ELEMENT_NODE)) {
168
172
  return null;
169
173
  }
package/lib/server/v4.js CHANGED
@@ -224,7 +224,8 @@ position, ariaVersion) {
224
224
  if (!engine) {
225
225
  return null;
226
226
  }
227
- const a11y = await getAccessibilityByLocation(engine, position.line + 1, position.character, ariaVersion);
227
+ // LSP counts the character from 0, the node list the column from 1.
228
+ const a11y = await getAccessibilityByLocation(engine, position.line + 1, position.character + 1, ariaVersion);
228
229
  if (!a11y) {
229
230
  return null;
230
231
  }
package/lib/server/v5.js CHANGED
@@ -262,7 +262,8 @@ position, ariaVersion) {
262
262
  if (!engine) {
263
263
  return null;
264
264
  }
265
- const a11y = await getAccessibilityByLocation(engine, position.line + 1, position.character, ariaVersion);
265
+ // LSP counts the character from 0, the node list the column from 1.
266
+ const a11y = await getAccessibilityByLocation(engine, position.line + 1, position.character + 1, ariaVersion);
266
267
  if (!a11y) {
267
268
  return null;
268
269
  }
package/locales/ja.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "keywords": {
3
+ ". ": "。",
3
4
  "computed accessibility properties": "計算済みアクセシビリティプロパティ",
4
5
  "hidden element": "非表示要素",
5
6
  "no corresponding role": "対応するロールなし",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/language-server",
3
- "version": "5.5.0",
3
+ "version": "5.6.1",
4
4
  "description": "Language Server Protocol server for markuplint",
5
5
  "repository": {
6
6
  "type": "git",
@@ -41,20 +41,22 @@
41
41
  "clean": "tsc --build --clean tsconfig.build.json"
42
42
  },
43
43
  "dependencies": {
44
- "@markuplint/file-resolver": "5.5.0",
45
- "@markuplint/i18n": "5.5.0",
46
- "@markuplint/ml-config": "5.5.0",
47
- "@markuplint/ml-spec": "5.5.0",
44
+ "@markuplint/file-resolver": "5.6.1",
45
+ "@markuplint/i18n": "5.6.0",
46
+ "@markuplint/ml-config": "5.6.1",
47
+ "@markuplint/ml-core": "5.6.1",
48
+ "@markuplint/ml-spec": "5.6.1",
48
49
  "debug": "^4.4.3",
49
- "markuplint": "5.5.0",
50
+ "markuplint": "5.6.1",
50
51
  "semver": "^7.8.6",
51
52
  "vscode-languageserver": "^9.0.1",
52
53
  "vscode-languageserver-textdocument": "^1.0.16"
53
54
  },
54
55
  "devDependencies": {
56
+ "@markuplint/test-tools": "5.6.1",
55
57
  "@types/debug": "4.1.13",
56
58
  "@types/semver": "7.8.0",
57
59
  "vscode-jsonrpc": "8.2.1"
58
60
  },
59
- "gitHead": "fedebcfd56eaec4642e68643b2f9e10750d810e1"
61
+ "gitHead": "a9245162df3699c4880469f493aaaf6103343d83"
60
62
  }