@intlayer/lsp 9.0.0-canary.12 → 9.0.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/dist/esm/callers/patterns.mjs.map +1 -1
- package/dist/esm/dictionaryUtils.mjs +1 -1
- package/dist/esm/dictionaryUtils.mjs.map +1 -1
- package/dist/esm/findFieldInFile.mjs.map +1 -1
- package/dist/esm/findKeyAtOffset.mjs.map +1 -1
- package/dist/esm/findKeyInContentFile.mjs +3 -3
- package/dist/esm/findKeyInContentFile.mjs.map +1 -1
- package/dist/esm/findTCallAtOffset.mjs.map +1 -1
- package/dist/esm/findUsageFieldAtOffset.mjs.map +1 -1
- package/dist/esm/index.mjs +6 -3
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/oxcUtils.mjs.map +1 -1
- package/dist/esm/usageAnalyzer.mjs +7 -4
- package/dist/esm/usageAnalyzer.mjs.map +1 -1
- package/dist/types/callers/index.d.ts +0 -3
- package/dist/types/callers/patterns.d.ts +20 -20
- package/dist/types/callers/patterns.d.ts.map +1 -1
- package/dist/types/dictionaryUtils.d.ts +0 -1
- package/dist/types/dictionaryUtils.d.ts.map +1 -1
- package/dist/types/findFieldInFile.d.ts +18 -19
- package/dist/types/findFieldInFile.d.ts.map +1 -1
- package/dist/types/findKeyAtOffset.d.ts +15 -15
- package/dist/types/findKeyAtOffset.d.ts.map +1 -1
- package/dist/types/findKeyInContentFile.d.ts +20 -20
- package/dist/types/findKeyInContentFile.d.ts.map +1 -1
- package/dist/types/findTCallAtOffset.d.ts +15 -15
- package/dist/types/findTCallAtOffset.d.ts.map +1 -1
- package/dist/types/findUsageFieldAtOffset.d.ts +14 -14
- package/dist/types/findUsageFieldAtOffset.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/oxcUtils.d.ts +22 -22
- package/dist/types/oxcUtils.d.ts.map +1 -1
- package/dist/types/usageAnalyzer.d.ts +95 -83
- package/dist/types/usageAnalyzer.d.ts.map +1 -1
- package/package.json +11 -11
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
//#region src/findTCallAtOffset.d.ts
|
|
2
2
|
/**
|
|
3
|
-
* Detect when the cursor is on a message usage carrying an explicit id: a
|
|
4
|
-
* `t('key')` call from any translator caller, a self call
|
|
5
|
-
* (`formatMessage({ id })`, `i18n._('id')`), a JSX message component or a
|
|
6
|
-
* lingui tagged template.
|
|
7
|
-
*
|
|
8
|
-
* Thin compatibility wrapper over `findMessageUsageAtOffset` — kept for the
|
|
9
|
-
* VS Code extension. `fieldName` is the dotted field path.
|
|
10
|
-
*
|
|
11
|
-
* Handles all assignment forms:
|
|
12
|
-
* const t = useTranslations('ns'); t('field')
|
|
13
|
-
* const { t } = useTranslation('ns'); t('field')
|
|
14
|
-
* const { t: translate } = useTranslation('ns'); translate('field')
|
|
15
|
-
* const t = await getFixedT('en', 'ns'); t('field')
|
|
16
|
-
* const { t } = useI18n({ namespace: 'ns' }); t('field')
|
|
17
|
-
*/
|
|
3
|
+
* Detect when the cursor is on a message usage carrying an explicit id: a
|
|
4
|
+
* `t('key')` call from any translator caller, a self call
|
|
5
|
+
* (`formatMessage({ id })`, `i18n._('id')`), a JSX message component or a
|
|
6
|
+
* lingui tagged template.
|
|
7
|
+
*
|
|
8
|
+
* Thin compatibility wrapper over `findMessageUsageAtOffset` — kept for the
|
|
9
|
+
* VS Code extension. `fieldName` is the dotted field path.
|
|
10
|
+
*
|
|
11
|
+
* Handles all assignment forms:
|
|
12
|
+
* const t = useTranslations('ns'); t('field')
|
|
13
|
+
* const { t } = useTranslation('ns'); t('field')
|
|
14
|
+
* const { t: translate } = useTranslation('ns'); translate('field')
|
|
15
|
+
* const t = await getFixedT('en', 'ns'); t('field')
|
|
16
|
+
* const { t } = useI18n({ namespace: 'ns' }); t('field')
|
|
17
|
+
*/
|
|
18
18
|
declare const findTCallAtOffset: (text: string, offset: number) => {
|
|
19
19
|
dictionaryKey: string;
|
|
20
20
|
fieldName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findTCallAtOffset.d.ts","names":[],"sources":["../../src/findTCallAtOffset.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"findTCallAtOffset.d.ts","names":[],"sources":["../../src/findTCallAtOffset.ts"],"mappings":";;;;;;;;;;;;;;;;;cAkBa,oBACX,cACA;EACG;EAAuB"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
//#region src/findUsageFieldAtOffset.d.ts
|
|
2
2
|
/**
|
|
3
|
-
* Detect when the cursor is on a field name that was obtained from a
|
|
4
|
-
* useIntlayer / getIntlayer call in the same file. Two patterns:
|
|
5
|
-
*
|
|
6
|
-
* Pattern 1 — destructuring:
|
|
7
|
-
* const { localeSwitcherLabel } = useIntlayer("locale-switcher")
|
|
8
|
-
* ^^^^^^^^^^^^^^^^^^ ← cursor here
|
|
9
|
-
*
|
|
10
|
-
* Pattern 2 — member access:
|
|
11
|
-
* const t = useIntlayer("locale-switcher")
|
|
12
|
-
* t.localeSwitcherLabel ← cursor on the property
|
|
13
|
-
*
|
|
14
|
-
* Thin compatibility wrapper over `findMessageUsageAtOffset`.
|
|
15
|
-
* Returns { dictionaryKey, fieldName } when matched, null otherwise.
|
|
16
|
-
*/
|
|
3
|
+
* Detect when the cursor is on a field name that was obtained from a
|
|
4
|
+
* useIntlayer / getIntlayer call in the same file. Two patterns:
|
|
5
|
+
*
|
|
6
|
+
* Pattern 1 — destructuring:
|
|
7
|
+
* const { localeSwitcherLabel } = useIntlayer("locale-switcher")
|
|
8
|
+
* ^^^^^^^^^^^^^^^^^^ ← cursor here
|
|
9
|
+
*
|
|
10
|
+
* Pattern 2 — member access:
|
|
11
|
+
* const t = useIntlayer("locale-switcher")
|
|
12
|
+
* t.localeSwitcherLabel ← cursor on the property
|
|
13
|
+
*
|
|
14
|
+
* Thin compatibility wrapper over `findMessageUsageAtOffset`.
|
|
15
|
+
* Returns { dictionaryKey, fieldName } when matched, null otherwise.
|
|
16
|
+
*/
|
|
17
17
|
declare const findUsageFieldAtOffset: (text: string, offset: number) => {
|
|
18
18
|
dictionaryKey: string;
|
|
19
19
|
fieldName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findUsageFieldAtOffset.d.ts","names":[],"sources":["../../src/findUsageFieldAtOffset.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"findUsageFieldAtOffset.d.ts","names":[],"sources":["../../src/findUsageFieldAtOffset.ts"],"mappings":";;;;;;;;;;;;;;;;cAiBa,yBACX,cACA;EACG;EAAuB"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {}
|
package/dist/types/oxcUtils.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
//#region src/oxcUtils.d.ts
|
|
2
2
|
type OxcNode = Record<string, unknown>;
|
|
3
3
|
/**
|
|
4
|
-
* Parse `text` into an Oxc program AST.
|
|
5
|
-
* Returns null when the parse completely fails (e.g. unsupported syntax).
|
|
6
|
-
* Oxc is generally resilient to partial/in-progress edits and still returns a
|
|
7
|
-
* usable AST alongside error diagnostics, so this is rare.
|
|
8
|
-
*/
|
|
4
|
+
* Parse `text` into an Oxc program AST.
|
|
5
|
+
* Returns null when the parse completely fails (e.g. unsupported syntax).
|
|
6
|
+
* Oxc is generally resilient to partial/in-progress edits and still returns a
|
|
7
|
+
* usable AST alongside error diagnostics, so this is rare.
|
|
8
|
+
*/
|
|
9
9
|
declare const parseText: (text: string) => OxcNode | null;
|
|
10
10
|
/**
|
|
11
|
-
* Depth-first walk of an Oxc AST. Visitor is called for every node that has
|
|
12
|
-
* a `type` property; returning `true` prunes that subtree.
|
|
13
|
-
*/
|
|
11
|
+
* Depth-first walk of an Oxc AST. Visitor is called for every node that has
|
|
12
|
+
* a `type` property; returning `true` prunes that subtree.
|
|
13
|
+
*/
|
|
14
14
|
declare const walkAst: (node: unknown, visitor: (node: OxcNode) => boolean | void) => void;
|
|
15
15
|
/**
|
|
16
|
-
* Build a child → parent reference map for upward traversal.
|
|
17
|
-
* Only AST-node-valued properties are followed; primitives are ignored.
|
|
18
|
-
*/
|
|
16
|
+
* Build a child → parent reference map for upward traversal.
|
|
17
|
+
* Only AST-node-valued properties are followed; primitives are ignored.
|
|
18
|
+
*/
|
|
19
19
|
declare const buildParentMap: (root: OxcNode) => Map<OxcNode, OxcNode>;
|
|
20
20
|
/** Byte offset of the node's start. */
|
|
21
21
|
declare const nodeStart: (node: OxcNode) => number;
|
|
@@ -24,27 +24,27 @@ declare const nodeEnd: (node: OxcNode) => number;
|
|
|
24
24
|
/** Returns `true` when `offset` falls inside the node's span (inclusive). */
|
|
25
25
|
declare const nodeContainsOffset: (node: OxcNode, offset: number) => boolean;
|
|
26
26
|
/**
|
|
27
|
-
* Returns `true` for nodes that carry a static string value:
|
|
28
|
-
* Literal / StringLiteral, and no-substitution TemplateLiteral.
|
|
29
|
-
*/
|
|
27
|
+
* Returns `true` for nodes that carry a static string value:
|
|
28
|
+
* Literal / StringLiteral, and no-substitution TemplateLiteral.
|
|
29
|
+
*/
|
|
30
30
|
declare const isStringLiteralNode: (node: OxcNode) => boolean;
|
|
31
31
|
/**
|
|
32
|
-
* Extract the static string value from a literal node, or null when the node
|
|
33
|
-
* is not a static string.
|
|
34
|
-
*/
|
|
32
|
+
* Extract the static string value from a literal node, or null when the node
|
|
33
|
+
* is not a static string.
|
|
34
|
+
*/
|
|
35
35
|
declare const getStaticStringValue: (node: OxcNode | undefined) => string | null;
|
|
36
36
|
/** Extract the string value from the Nth argument of a call expression. */
|
|
37
37
|
declare const getStringArgAt: (callNode: OxcNode, index: number) => string | null;
|
|
38
38
|
/** Extract the string value from the first argument of a call expression. */
|
|
39
39
|
declare const getFirstStringArg: (callExpressionNode: OxcNode) => string | null;
|
|
40
40
|
/**
|
|
41
|
-
* Find the property node named `propertyName` inside an ObjectExpression.
|
|
42
|
-
*/
|
|
41
|
+
* Find the property node named `propertyName` inside an ObjectExpression.
|
|
42
|
+
*/
|
|
43
43
|
declare const getObjectPropertyNode: (objectExpression: OxcNode | undefined, propertyName: string) => OxcNode | null;
|
|
44
44
|
/**
|
|
45
|
-
* Read a static string property from an ObjectExpression argument,
|
|
46
|
-
* e.g. the `namespace` of `useI18n({ namespace: 'about' })`.
|
|
47
|
-
*/
|
|
45
|
+
* Read a static string property from an ObjectExpression argument,
|
|
46
|
+
* e.g. the `namespace` of `useI18n({ namespace: 'about' })`.
|
|
47
|
+
*/
|
|
48
48
|
declare const getObjectPropertyString: (objectExpression: OxcNode | undefined, propertyName: string) => string | null;
|
|
49
49
|
/** Get the identifier or string name of an object-property key node. */
|
|
50
50
|
declare const getPropertyKeyName: (keyNode: OxcNode | undefined) => string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oxcUtils.d.ts","names":[],"sources":["../../src/oxcUtils.ts"],"mappings":";KAEY,
|
|
1
|
+
{"version":3,"file":"oxcUtils.d.ts","names":[],"sources":["../../src/oxcUtils.ts"],"mappings":";KAEY,UAAU;;;;;;;cAQT,YAAa,iBAAe;;;;;cAc5B,UACX,eAEA,UAAU,MAAM;;;;;cAyBL,iBAAkB,MAAM,YAAU,IAAI,SAAS;;cA4B/C,YAAa,MAAM;;cAMnB,UAAW,MAAM;;cAMjB,qBAAsB,MAAM,SAAS;;;;;cAOrC,sBAAuB,MAAM;;;;;cAkB7B,uBACX,MAAM;;cA8BK,iBACX,UAAU,SACV;;cAUW,oBAAqB,oBAAoB;;;;cAMzC,wBACX,kBAAkB,qBAClB,yBACC;;;;;cA4BU,0BACX,kBAAkB,qBAClB;;cAUW,qBACX,SAAS"}
|
|
@@ -1,128 +1,140 @@
|
|
|
1
1
|
import { OxcNode } from "./oxcUtils.js";
|
|
2
|
-
|
|
3
2
|
//#region src/usageAnalyzer.d.ts
|
|
4
3
|
/** How a message usage appears in source code. */
|
|
5
4
|
type MessageUsageKind = "call" | "member" | "destructure" | "jsx" | "tagged-template" | "namespace";
|
|
6
5
|
/**
|
|
7
|
-
* One resolved translation usage inside a source file: which dictionary and
|
|
8
|
-
* field it reads, and the text span it occupies.
|
|
9
|
-
*/
|
|
6
|
+
* One resolved translation usage inside a source file: which dictionary and
|
|
7
|
+
* field it reads, and the text span it occupies.
|
|
8
|
+
*/
|
|
10
9
|
type MessageUsage = {
|
|
11
|
-
/** The intlayer dictionary key the usage reads from. */
|
|
10
|
+
/** The intlayer dictionary key the usage reads from. */
|
|
11
|
+
dictionaryKey: string;
|
|
12
12
|
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
* Path of content fields from the dictionary root. Empty for
|
|
14
|
+
* dictionary-level usages (`namespace` kind, or a bare content variable).
|
|
15
|
+
*/
|
|
16
16
|
fieldPath: string[];
|
|
17
17
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
* Spans of each `fieldPath` segment, aligned by index, when the segments
|
|
19
|
+
* are addressable in source (member chains). Used to trim the path to the
|
|
20
|
+
* segment under the cursor.
|
|
21
|
+
*/
|
|
22
22
|
fieldSpans?: {
|
|
23
23
|
start: number;
|
|
24
24
|
end: number;
|
|
25
|
-
}[];
|
|
26
|
-
|
|
25
|
+
}[];
|
|
26
|
+
/** Start offset of the usage expression. */
|
|
27
|
+
start: number;
|
|
28
|
+
/** End offset of the usage expression. */
|
|
27
29
|
end: number;
|
|
28
|
-
kind: MessageUsageKind;
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
kind: MessageUsageKind;
|
|
31
|
+
/** The caller that produced the usage, e.g. `'useTranslations'`. */
|
|
32
|
+
callerName: string;
|
|
33
|
+
/** The library the caller belongs to, e.g. `'next-intl'` or `'intlayer'`. */
|
|
34
|
+
library: string;
|
|
35
|
+
/** Module specifier the caller was imported from, when resolvable. */
|
|
31
36
|
moduleSource?: string;
|
|
32
37
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
* `true` for `member` usages that are a bare reference to a bound variable
|
|
39
|
+
* (`{greet}` in JSX after `const { greet } = useIntlayer(…)`) — the field
|
|
40
|
+
* name itself is not spelled at the usage site. Excluded from
|
|
41
|
+
* find-references results but kept for decorations and hover.
|
|
42
|
+
*/
|
|
38
43
|
isBareReference?: boolean;
|
|
39
44
|
};
|
|
40
45
|
/**
|
|
41
|
-
* Analyse a source file and return every resolvable translation usage:
|
|
42
|
-
* base-intlayer content access and all compat-library forms (translation
|
|
43
|
-
* functions, self calls, JSX message components, tagged templates).
|
|
44
|
-
*
|
|
45
|
-
* Pure and self-contained (oxc parse only) — shared by the LSP handlers and
|
|
46
|
-
* the VS Code extension providers/decorations.
|
|
47
|
-
*
|
|
48
|
-
* @param text - Full source text (a script: TS/TSX or an extracted SFC block).
|
|
49
|
-
* @returns Usages ordered by start offset.
|
|
50
|
-
*/
|
|
46
|
+
* Analyse a source file and return every resolvable translation usage:
|
|
47
|
+
* base-intlayer content access and all compat-library forms (translation
|
|
48
|
+
* functions, self calls, JSX message components, tagged templates).
|
|
49
|
+
*
|
|
50
|
+
* Pure and self-contained (oxc parse only) — shared by the LSP handlers and
|
|
51
|
+
* the VS Code extension providers/decorations.
|
|
52
|
+
*
|
|
53
|
+
* @param text - Full source text (a script: TS/TSX or an extracted SFC block).
|
|
54
|
+
* @returns Usages ordered by start offset.
|
|
55
|
+
*/
|
|
51
56
|
declare const collectMessageUsages: (text: string) => MessageUsage[];
|
|
52
57
|
/**
|
|
53
|
-
* Resolve the dictionary key declared by a single call-expression node when
|
|
54
|
-
* it matches any registered non-self caller (`useIntlayer("key")`,
|
|
55
|
-
* `useI18n({ namespace })`, …). Used for on-the-fly checks where the full
|
|
56
|
-
* file analysis is not needed (e.g. completion context).
|
|
57
|
-
*
|
|
58
|
-
* @param callNode - A candidate CallExpression node.
|
|
59
|
-
*/
|
|
58
|
+
* Resolve the dictionary key declared by a single call-expression node when
|
|
59
|
+
* it matches any registered non-self caller (`useIntlayer("key")`,
|
|
60
|
+
* `useI18n({ namespace })`, …). Used for on-the-fly checks where the full
|
|
61
|
+
* file analysis is not needed (e.g. completion context).
|
|
62
|
+
*
|
|
63
|
+
* @param callNode - A candidate CallExpression node.
|
|
64
|
+
*/
|
|
60
65
|
declare const matchCallNamespace: (callNode: OxcNode) => string | null;
|
|
61
66
|
/**
|
|
62
|
-
* A call site declaring which dictionary a caller reads
|
|
63
|
-
* (`useIntlayer("home")`, `useI18n({ namespace: 'home' })`), with the spans
|
|
64
|
-
* needed to anchor diagnostics and cursor checks.
|
|
65
|
-
*/
|
|
67
|
+
* A call site declaring which dictionary a caller reads
|
|
68
|
+
* (`useIntlayer("home")`, `useI18n({ namespace: 'home' })`), with the spans
|
|
69
|
+
* needed to anchor diagnostics and cursor checks.
|
|
70
|
+
*/
|
|
66
71
|
type NamespaceReference = {
|
|
67
72
|
dictionaryKey: string;
|
|
68
73
|
callerName: string;
|
|
69
|
-
library: string;
|
|
74
|
+
library: string;
|
|
75
|
+
/** Span of the whole call expression. */
|
|
70
76
|
callStart: number;
|
|
71
|
-
callEnd: number;
|
|
77
|
+
callEnd: number;
|
|
78
|
+
/** Span of the matched callee name (identifier or method property). */
|
|
72
79
|
calleeStart: number;
|
|
73
|
-
calleeEnd: number;
|
|
80
|
+
calleeEnd: number;
|
|
81
|
+
/** Span of the namespace argument (string literal or option value). */
|
|
74
82
|
namespaceStart: number;
|
|
75
83
|
namespaceEnd: number;
|
|
76
84
|
};
|
|
77
85
|
/**
|
|
78
|
-
* Collect every call site with an addressable namespace argument (positional
|
|
79
|
-
* or options property) resolving to a static string. Powers the
|
|
80
|
-
* unknown-dictionary diagnostics and `findKeyAtOffset`.
|
|
81
|
-
*
|
|
82
|
-
* Self callers (`formatMessage`, lingui `t`/`_`) don't declare a namespace at
|
|
83
|
-
* the call site and are excluded.
|
|
84
|
-
*
|
|
85
|
-
* @param text - Full source text.
|
|
86
|
-
*/
|
|
86
|
+
* Collect every call site with an addressable namespace argument (positional
|
|
87
|
+
* or options property) resolving to a static string. Powers the
|
|
88
|
+
* unknown-dictionary diagnostics and `findKeyAtOffset`.
|
|
89
|
+
*
|
|
90
|
+
* Self callers (`formatMessage`, lingui `t`/`_`) don't declare a namespace at
|
|
91
|
+
* the call site and are excluded.
|
|
92
|
+
*
|
|
93
|
+
* @param text - Full source text.
|
|
94
|
+
*/
|
|
87
95
|
declare const collectNamespaceReferences: (text: string) => NamespaceReference[];
|
|
88
96
|
/**
|
|
89
|
-
* A source variable bound to a dictionary by a caller declaration:
|
|
90
|
-
* dictionary content (or a field subtree of it) for `content` callers, or a
|
|
91
|
-
* translation function for `return-value` / `destructured-t` callers.
|
|
92
|
-
*/
|
|
97
|
+
* A source variable bound to a dictionary by a caller declaration:
|
|
98
|
+
* dictionary content (or a field subtree of it) for `content` callers, or a
|
|
99
|
+
* translation function for `return-value` / `destructured-t` callers.
|
|
100
|
+
*/
|
|
93
101
|
type CallerVariableBinding = {
|
|
94
|
-
/** Local variable name. */
|
|
102
|
+
/** Local variable name. */
|
|
103
|
+
variableName: string;
|
|
104
|
+
/** The dictionary the variable reads from. */
|
|
95
105
|
dictionaryKey: string;
|
|
96
106
|
/**
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
basePath: string[];
|
|
101
|
-
|
|
107
|
+
* Field path from the dictionary root the variable points at (content
|
|
108
|
+
* bindings), or the key prefix applied to every call (translator bindings).
|
|
109
|
+
*/
|
|
110
|
+
basePath: string[];
|
|
111
|
+
/** Whether the variable holds content or a translation function. */
|
|
112
|
+
bindingKind: "content" | "translator";
|
|
113
|
+
/** The caller that created the binding. */
|
|
102
114
|
callerName: string;
|
|
103
115
|
library: string;
|
|
104
116
|
};
|
|
105
117
|
/**
|
|
106
|
-
* Collect every variable bound to a dictionary in the file. Used by consumers
|
|
107
|
-
* that scan non-script regions (Vue/Angular templates) for references to
|
|
108
|
-
* those variables, or that need to know which dictionaries a file consumes.
|
|
109
|
-
*
|
|
110
|
-
* @param text - Full source text (a script: TS/TSX or an extracted SFC block).
|
|
111
|
-
*/
|
|
118
|
+
* Collect every variable bound to a dictionary in the file. Used by consumers
|
|
119
|
+
* that scan non-script regions (Vue/Angular templates) for references to
|
|
120
|
+
* those variables, or that need to know which dictionaries a file consumes.
|
|
121
|
+
*
|
|
122
|
+
* @param text - Full source text (a script: TS/TSX or an extracted SFC block).
|
|
123
|
+
*/
|
|
112
124
|
declare const collectCallerBindings: (text: string) => CallerVariableBinding[];
|
|
113
125
|
/**
|
|
114
|
-
* Find the most specific translation usage at `offset`.
|
|
115
|
-
*
|
|
116
|
-
* For member chains the field path is trimmed to the segment under the
|
|
117
|
-
* cursor: hovering `section` in `content.section.title` yields
|
|
118
|
-
* `['section']`, not the full chain.
|
|
119
|
-
*
|
|
120
|
-
* Dictionary-level `namespace` usages are only returned when no field-level
|
|
121
|
-
* usage matches the offset.
|
|
122
|
-
*
|
|
123
|
-
* @param text - Full source text.
|
|
124
|
-
* @param offset - Cursor offset in `text`.
|
|
125
|
-
*/
|
|
126
|
+
* Find the most specific translation usage at `offset`.
|
|
127
|
+
*
|
|
128
|
+
* For member chains the field path is trimmed to the segment under the
|
|
129
|
+
* cursor: hovering `section` in `content.section.title` yields
|
|
130
|
+
* `['section']`, not the full chain.
|
|
131
|
+
*
|
|
132
|
+
* Dictionary-level `namespace` usages are only returned when no field-level
|
|
133
|
+
* usage matches the offset.
|
|
134
|
+
*
|
|
135
|
+
* @param text - Full source text.
|
|
136
|
+
* @param offset - Cursor offset in `text`.
|
|
137
|
+
*/
|
|
126
138
|
declare const findMessageUsageAtOffset: (text: string, offset: number) => MessageUsage | null;
|
|
127
139
|
//#endregion
|
|
128
140
|
export { CallerVariableBinding, MessageUsage, MessageUsageKind, NamespaceReference, collectCallerBindings, collectMessageUsages, collectNamespaceReferences, findMessageUsageAtOffset, matchCallNamespace };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usageAnalyzer.d.ts","names":[],"sources":["../../src/usageAnalyzer.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"usageAnalyzer.d.ts","names":[],"sources":["../../src/usageAnalyzer.ts"],"mappings":";;;KAwBY;;;;;KAkBA;;EAEV;;;;;EAKA;;;;;;EAMA;IAAe;IAAe;;;EAE9B;;EAEA;EACA,MAAM;;EAEN;;EAEA;;EAEA;;;;;;;EAOA;;;;;;;;;;;;;cA47BW,uBAAwB,iBAAe;;;;;;;;;cAkCvC,qBAAsB,UAAU;;;;;;KAgCjC;EACV;EACA;EACA;;EAEA;EACA;;EAEA;EACA;;EAEA;EACA;;;;;;;;;;;;cAwCW,6BACX,iBACC;;;;;;KA8DS;;EAEV;;EAEA;;;;;EAKA;;EAEA;;EAEA;EACA;;;;;;;;;cAUW,wBACX,iBACC;;;;;;;;;;;;;;cA0DU,2BACX,cACA,mBACC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/lsp",
|
|
3
|
-
"version": "9.0.0
|
|
3
|
+
"version": "9.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Intlayer Language Server. Handle LSP to help IDE and AI agent to use Intlayer",
|
|
6
6
|
"keywords": [
|
|
@@ -83,23 +83,23 @@
|
|
|
83
83
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"@intlayer/config": "9.0.0
|
|
87
|
-
"@intlayer/engine": "9.0.0
|
|
88
|
-
"@intlayer/types": "9.0.0
|
|
89
|
-
"@intlayer/unmerged-dictionaries-entry": "9.0.0
|
|
90
|
-
"oxc-parser": "0.
|
|
91
|
-
"vscode-languageserver": "10.
|
|
86
|
+
"@intlayer/config": "9.0.0",
|
|
87
|
+
"@intlayer/engine": "9.0.0",
|
|
88
|
+
"@intlayer/types": "9.0.0",
|
|
89
|
+
"@intlayer/unmerged-dictionaries-entry": "9.0.0",
|
|
90
|
+
"oxc-parser": "0.138.0",
|
|
91
|
+
"vscode-languageserver": "10.1.0",
|
|
92
92
|
"vscode-languageserver-textdocument": "1.0.12"
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
|
-
"@types/node": "
|
|
95
|
+
"@types/node": "26.1.1",
|
|
96
96
|
"@utils/ts-config": "1.0.4",
|
|
97
97
|
"@utils/ts-config-types": "1.0.4",
|
|
98
98
|
"@utils/tsdown-config": "1.0.4",
|
|
99
99
|
"rimraf": "6.1.3",
|
|
100
|
-
"tsdown": "0.
|
|
101
|
-
"typescript": "
|
|
102
|
-
"vitest": "4.1.
|
|
100
|
+
"tsdown": "0.22.13",
|
|
101
|
+
"typescript": "7.0.2",
|
|
102
|
+
"vitest": "4.1.10"
|
|
103
103
|
},
|
|
104
104
|
"engines": {
|
|
105
105
|
"node": ">=14.18"
|