xq-lsp 1.8.0 → 1.8.2
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 +15 -0
- package/dist/call-hierarchy.d.ts +2 -2
- package/dist/call-hierarchy.js +26 -11
- package/dist/code-lens.d.ts +2 -2
- package/dist/code-lens.js +2 -2
- package/dist/completion.js +14 -0
- package/dist/references.d.ts +13 -3
- package/dist/references.js +24 -14
- package/dist/runtimes/existdb/file.xq +53 -0
- package/dist/runtimes/existdb/request.xq +16 -0
- package/dist/runtimes/existdb/response.xq +57 -4
- package/dist/runtimes/existdb/scheduler.xq +173 -0
- package/dist/runtimes/existdb/system.xq +23 -5
- package/dist/runtimes/existdb/util.xq +91 -12
- package/dist/runtimes/existdb/xmldb.xq +12 -1
- package/dist/server.js +66 -34
- package/package.json +1 -1
- package/src/call-hierarchy.ts +23 -10
- package/src/code-lens.ts +9 -3
- package/src/completion.ts +15 -0
- package/src/references.ts +32 -9
- package/src/runtimes/existdb/file.xq +53 -0
- package/src/runtimes/existdb/request.xq +16 -0
- package/src/runtimes/existdb/response.xq +57 -4
- package/src/runtimes/existdb/scheduler.xq +173 -0
- package/src/runtimes/existdb/system.xq +23 -5
- package/src/runtimes/existdb/util.xq +91 -12
- package/src/runtimes/existdb/xmldb.xq +12 -1
- package/src/server.ts +69 -48
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.8.2](https://github.com/DrRataplan/xq-lsp/compare/lsp-v1.8.1...lsp-v1.8.2) (2026-09-01)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* recover eXist-db functions the generator silently dropped ([6e76557](https://github.com/DrRataplan/xq-lsp/commit/6e765574bb484fa650ab83cf33ee301686b92604))
|
|
9
|
+
* use an explicit textEdit for auto-declare-namespace completions ([b319917](https://github.com/DrRataplan/xq-lsp/commit/b3199170a138bc2281cff86bbd4368b0d1c5b9f7))
|
|
10
|
+
|
|
11
|
+
## [1.8.1](https://github.com/DrRataplan/xq-lsp/compare/lsp-v1.8.0...lsp-v1.8.1) (2026-07-29)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* stop retaining full ASTs for every glob-matched file to prevent OOM ([b44460f](https://github.com/DrRataplan/xq-lsp/commit/b44460f1de449b48903ebddff4f56b7524b99234))
|
|
17
|
+
|
|
3
18
|
## [1.8.0](https://github.com/DrRataplan/xq-lsp/compare/lsp-v1.7.0...lsp-v1.8.0) (2026-07-28)
|
|
4
19
|
|
|
5
20
|
|
package/dist/call-hierarchy.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CallHierarchyItem, CallHierarchyIncomingCall, CallHierarchyOutgoingCall } from "vscode-languageserver/node.js";
|
|
2
2
|
import type { FileAnalysis } from "./types.ts";
|
|
3
|
-
import type { FileRecord } from "./references.ts";
|
|
3
|
+
import type { FileRecord, LoadAst } from "./references.ts";
|
|
4
4
|
/**
|
|
5
5
|
* Resolve the function under the cursor (declaration name or call-site name) to a
|
|
6
6
|
* `CallHierarchyItem[]`, the same way `getDefinition` resolves go-to-definition targets.
|
|
@@ -17,4 +17,4 @@ export declare function getOutgoingCalls(item: CallHierarchyItem, text: string,
|
|
|
17
17
|
* namespace + local name + arity), grouped by each call site's enclosing
|
|
18
18
|
* `declare function` — found by walking up the AST from the call-site offset.
|
|
19
19
|
*/
|
|
20
|
-
export declare function getIncomingCalls(item: CallHierarchyItem, itemText: string, itemAnalysis: FileAnalysis, getOtherFiles: () => FileRecord[]): CallHierarchyIncomingCall[];
|
|
20
|
+
export declare function getIncomingCalls(item: CallHierarchyItem, itemText: string, itemAnalysis: FileAnalysis, getOtherFiles: () => FileRecord[], loadAst: LoadAst): CallHierarchyIncomingCall[];
|
package/dist/call-hierarchy.js
CHANGED
|
@@ -143,34 +143,49 @@ export function getOutgoingCalls(item, text, analysis, imported) {
|
|
|
143
143
|
* namespace + local name + arity), grouped by each call site's enclosing
|
|
144
144
|
* `declare function` — found by walking up the AST from the call-site offset.
|
|
145
145
|
*/
|
|
146
|
-
export function getIncomingCalls(item, itemText, itemAnalysis, getOtherFiles) {
|
|
146
|
+
export function getIncomingCalls(item, itemText, itemAnalysis, getOtherFiles, loadAst) {
|
|
147
147
|
const offset = toOffset(itemText, item.selectionRange.start);
|
|
148
148
|
// includeDeclaration:false — we only want actual call sites, not the declaration itself.
|
|
149
|
-
const callSites = getReferences(item.uri, itemText, offset, itemAnalysis, false, getOtherFiles);
|
|
149
|
+
const callSites = getReferences(item.uri, itemText, offset, itemAnalysis, false, getOtherFiles, loadAst);
|
|
150
150
|
if (callSites.length === 0)
|
|
151
151
|
return [];
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
152
|
+
// getOtherFiles() returns cached, ast-free records — cheap to re-iterate for a uri->text
|
|
153
|
+
// lookup. The full (ast-bearing) analysis for each call site's file is fetched below, once
|
|
154
|
+
// per distinct uri, via loadAst.
|
|
155
|
+
const textByUri = new Map([[item.uri, itemText]]);
|
|
156
|
+
for (const file of getOtherFiles())
|
|
157
|
+
if (!textByUri.has(file.uri))
|
|
158
|
+
textByUri.set(file.uri, file.text);
|
|
159
|
+
const analysisByUri = new Map([[item.uri, itemAnalysis]]);
|
|
155
160
|
const groups = new Map();
|
|
156
161
|
for (const loc of callSites) {
|
|
157
|
-
const
|
|
158
|
-
if (
|
|
162
|
+
const text = textByUri.get(loc.uri);
|
|
163
|
+
if (text === undefined)
|
|
159
164
|
continue;
|
|
160
|
-
|
|
161
|
-
|
|
165
|
+
let fileAnalysis = analysisByUri.get(loc.uri);
|
|
166
|
+
if (!fileAnalysis) {
|
|
167
|
+
const loaded = loadAst(loc.uri, text);
|
|
168
|
+
if (!loaded)
|
|
169
|
+
continue;
|
|
170
|
+
fileAnalysis = loaded;
|
|
171
|
+
analysisByUri.set(loc.uri, fileAnalysis);
|
|
172
|
+
}
|
|
173
|
+
if (!fileAnalysis.ast)
|
|
174
|
+
continue;
|
|
175
|
+
const callOffset = toOffset(text, loc.range.start);
|
|
176
|
+
const stack = nodeStackAtOffset(fileAnalysis.ast, callOffset);
|
|
162
177
|
// Function declarations can't nest in XQuery, so at most one AnnotatedDecl/FunctionDecl
|
|
163
178
|
// pair appears in the stack; a call at module level (no enclosing function) has none.
|
|
164
179
|
const enclosingDecl = stack.find((n) => n.type === "AnnotatedDecl" && directChildOf(n, "FunctionDecl"));
|
|
165
180
|
if (!enclosingDecl)
|
|
166
181
|
continue;
|
|
167
|
-
const enclosingFn =
|
|
182
|
+
const enclosingFn = fileAnalysis.functions.find((f) => f.sourceOffset === enclosingDecl.start);
|
|
168
183
|
if (!enclosingFn)
|
|
169
184
|
continue;
|
|
170
185
|
const key = `${qnameKey(enclosingFn.qname)}#${enclosingFn.arity}@${loc.uri}`;
|
|
171
186
|
let group = groups.get(key);
|
|
172
187
|
if (!group) {
|
|
173
|
-
const from = buildItemForFunction(enclosingFn,
|
|
188
|
+
const from = buildItemForFunction(enclosingFn, fileAnalysis, loc.uri, text);
|
|
174
189
|
if (!from)
|
|
175
190
|
continue;
|
|
176
191
|
group = { from, ranges: [] };
|
package/dist/code-lens.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CodeLens } from "vscode-languageserver/node.js";
|
|
2
2
|
import type { TextDocument } from "vscode-languageserver-textdocument";
|
|
3
3
|
import type { FileAnalysis } from "./types.ts";
|
|
4
|
-
import type { FileRecord } from "./references.ts";
|
|
4
|
+
import type { FileRecord, LoadAst } from "./references.ts";
|
|
5
5
|
/** Carried on each unresolved lens so `resolveCodeLens` can find the declaration again later. */
|
|
6
6
|
export interface CodeLensData {
|
|
7
7
|
uri: string;
|
|
@@ -20,4 +20,4 @@ export declare function buildCodeLenses(doc: TextDocument, analysis: FileAnalysi
|
|
|
20
20
|
* reference search `textDocument/references` uses. Declarations aren't counted as
|
|
21
21
|
* references. 0 references is reported as-is — it's a useful signal, not hidden.
|
|
22
22
|
*/
|
|
23
|
-
export declare function resolveCodeLens(lens: CodeLens, text: string, analysis: FileAnalysis, getOtherFiles: () => FileRecord[]): CodeLens;
|
|
23
|
+
export declare function resolveCodeLens(lens: CodeLens, text: string, analysis: FileAnalysis, getOtherFiles: () => FileRecord[], loadAst: LoadAst): CodeLens;
|
package/dist/code-lens.js
CHANGED
|
@@ -60,10 +60,10 @@ function findNameOffset(ast, analysis, data) {
|
|
|
60
60
|
* reference search `textDocument/references` uses. Declarations aren't counted as
|
|
61
61
|
* references. 0 references is reported as-is — it's a useful signal, not hidden.
|
|
62
62
|
*/
|
|
63
|
-
export function resolveCodeLens(lens, text, analysis, getOtherFiles) {
|
|
63
|
+
export function resolveCodeLens(lens, text, analysis, getOtherFiles, loadAst) {
|
|
64
64
|
const data = lens.data;
|
|
65
65
|
const ast = analysis.ast;
|
|
66
66
|
const offset = data && ast ? findNameOffset(ast, analysis, data) : null;
|
|
67
|
-
const count = data && offset !== null ? getReferences(data.uri, text, offset, analysis, false, getOtherFiles).length : 0;
|
|
67
|
+
const count = data && offset !== null ? getReferences(data.uri, text, offset, analysis, false, getOtherFiles, loadAst).length : 0;
|
|
68
68
|
return { ...lens, command: { title: `${count} references`, command: "" } };
|
|
69
69
|
}
|
package/dist/completion.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CompletionItem, CompletionItemKind, InsertTextFormat, MarkupKind } from "vscode-languageserver/node.js";
|
|
2
2
|
import { getCompletions as getCoreCompletions } from "./completion-core.js";
|
|
3
3
|
import { findImportInsertPosition, findDeclareNsInsertPosition, computeRelativePath } from "./namespace-diagnostics.js";
|
|
4
|
+
import { offsetToPosition } from "./references.js";
|
|
4
5
|
export function getCompletions(ctx, currentAnalysis, importedAnalyses, snippets, lastValidAnalysis, availableAnalyses, knownNamespaces, editContext) {
|
|
5
6
|
return getCoreCompletions(ctx, currentAnalysis, importedAnalyses, snippets, lastValidAnalysis, availableAnalyses, knownNamespaces).map((e) => {
|
|
6
7
|
const item = {
|
|
@@ -33,6 +34,19 @@ export function getCompletions(ctx, currentAnalysis, importedAnalyses, snippets,
|
|
|
33
34
|
newText = `declare namespace ${e.additionalEdit.prefix} = "${e.additionalEdit.namespaceUri}";\n`;
|
|
34
35
|
}
|
|
35
36
|
item.additionalTextEdits = [{ range: { start: insertPos, end: insertPos }, newText }];
|
|
37
|
+
// The "declare namespace" entry's own insertText is just an echo of what's already
|
|
38
|
+
// typed after the prefix (often ""). Some clients (e.g. eglot) fall back to inserting
|
|
39
|
+
// the item's label verbatim at the cursor when insertText is empty, which would dump
|
|
40
|
+
// the whole `declare namespace tei = "...";` statement inline. An explicit textEdit
|
|
41
|
+
// with a concrete range forces every spec-compliant client onto the deterministic
|
|
42
|
+
// replace path instead of guessing, so only the additionalTextEdit above lands the text.
|
|
43
|
+
if (e.additionalEdit.kind === "declare-namespace") {
|
|
44
|
+
const start = ctx.cursorOffset - e.insertText.length;
|
|
45
|
+
item.textEdit = {
|
|
46
|
+
range: { start: offsetToPosition(docText, start), end: offsetToPosition(docText, ctx.cursorOffset) },
|
|
47
|
+
newText: e.insertText,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
36
50
|
}
|
|
37
51
|
return item;
|
|
38
52
|
});
|
package/dist/references.d.ts
CHANGED
|
@@ -10,6 +10,14 @@ export declare function offsetToPosition(text: string, offset: number): {
|
|
|
10
10
|
line: number;
|
|
11
11
|
character: number;
|
|
12
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* Parses one glob-matched file's full AST on demand for a cross-file occurrence walk.
|
|
15
|
+
* Reuses `analysisCache` (open documents, explicit imports) when the file is already
|
|
16
|
+
* resident; otherwise parses fresh and returns without caching the result, so a
|
|
17
|
+
* cross-file search never retains more than the file currently being walked. See
|
|
18
|
+
* `getGlobFileAccess` in server.ts.
|
|
19
|
+
*/
|
|
20
|
+
export type LoadAst = (uri: string, text: string) => FileAnalysis | null;
|
|
13
21
|
/**
|
|
14
22
|
* Find all references to the symbol at `offset` in the current file.
|
|
15
23
|
*
|
|
@@ -26,9 +34,11 @@ export declare function offsetToPosition(text: string, offset: number): {
|
|
|
26
34
|
* Requires a valid AST (returns `[]` on the regex-fallback path, since parse
|
|
27
35
|
* failures don't produce reliable node positions).
|
|
28
36
|
* `getOtherFiles` is only invoked for symbol kinds that need a cross-file
|
|
29
|
-
* search, so callers can make it lazy.
|
|
37
|
+
* search, so callers can make it lazy. `getOtherFiles` returns lightweight,
|
|
38
|
+
* ast-free records for cheap candidate filtering; `loadAst` parses a specific
|
|
39
|
+
* candidate's full AST on demand once it survives that filter (see `LoadAst`).
|
|
30
40
|
*/
|
|
31
|
-
export declare function getReferences(currentUri: string, currentText: string, offset: number, analysis: FileAnalysis, includeDeclaration: boolean, getOtherFiles: () => FileRecord[]): Location[];
|
|
41
|
+
export declare function getReferences(currentUri: string, currentText: string, offset: number, analysis: FileAnalysis, includeDeclaration: boolean, getOtherFiles: () => FileRecord[], loadAst: LoadAst): Location[];
|
|
32
42
|
/**
|
|
33
43
|
* Range of the renameable identifier at `offset`, trimmed to the local-name part
|
|
34
44
|
* (namespace-prefix qualifiers are left untouched) or the bare prefix NCName for
|
|
@@ -48,7 +58,7 @@ export declare function getRenameRangeAtOffset(currentText: string, offset: numb
|
|
|
48
58
|
* recognizable at `offset`, or no resolvable local declaration (e.g. a builtin
|
|
49
59
|
* function or a predeclared runtime namespace prefix).
|
|
50
60
|
*/
|
|
51
|
-
export declare function getRenameLocations(currentUri: string, currentText: string, offset: number, analysis: FileAnalysis, getOtherFiles: () => FileRecord[]): Location[] | null;
|
|
61
|
+
export declare function getRenameLocations(currentUri: string, currentText: string, offset: number, analysis: FileAnalysis, getOtherFiles: () => FileRecord[], loadAst: LoadAst): Location[] | null;
|
|
52
62
|
/**
|
|
53
63
|
* Highlight every occurrence of the symbol at `offset` within the current
|
|
54
64
|
* document only (`textDocument/documentHighlight` is file-scoped by spec, even
|
package/dist/references.js
CHANGED
|
@@ -277,8 +277,7 @@ function getPrefixReferences(currentUri, currentText, ast, analysis, prefix, inc
|
|
|
277
277
|
}
|
|
278
278
|
return locs;
|
|
279
279
|
}
|
|
280
|
-
|
|
281
|
-
function getVariableReferences(currentUri, currentText, ast, analysis, offset, includeDeclaration, getOtherFiles, trimToLocalName = false) {
|
|
280
|
+
function getVariableReferences(currentUri, currentText, ast, analysis, offset, includeDeclaration, getOtherFiles, loadAst, trimToLocalName = false) {
|
|
282
281
|
const occurrences = [];
|
|
283
282
|
walkVariables(ast, analysis, new ScopeStack(), occurrences);
|
|
284
283
|
const target = occurrences.find((o) => offset >= o.start && offset <= o.end);
|
|
@@ -301,10 +300,16 @@ function getVariableReferences(currentUri, currentText, ast, analysis, offset, i
|
|
|
301
300
|
o,
|
|
302
301
|
}));
|
|
303
302
|
for (const file of getOtherFiles()) {
|
|
304
|
-
|
|
303
|
+
// Cheap pre-filter: localName always appears verbatim in source regardless of EQName
|
|
304
|
+
// syntax (prefixed, URIQualified, or unprefixed), so its absence rules out a match
|
|
305
|
+
// without needing to parse the file at all.
|
|
306
|
+
if (file.uri === currentUri || !file.text.includes(localName))
|
|
307
|
+
continue;
|
|
308
|
+
const fileAnalysis = loadAst(file.uri, file.text);
|
|
309
|
+
if (!fileAnalysis?.ast)
|
|
305
310
|
continue;
|
|
306
311
|
const fileOccs = [];
|
|
307
|
-
walkVariables(
|
|
312
|
+
walkVariables(fileAnalysis.ast, fileAnalysis, new ScopeStack(), fileOccs);
|
|
308
313
|
for (const o of matches(fileOccs))
|
|
309
314
|
all.push({ uri: file.uri, text: file.text, o });
|
|
310
315
|
}
|
|
@@ -313,7 +318,7 @@ function getVariableReferences(currentUri, currentText, ast, analysis, offset, i
|
|
|
313
318
|
return [];
|
|
314
319
|
return all.filter((m) => includeDeclaration || !m.o.isDeclaration).map((m) => toLoc(m.uri, m.text, m.o));
|
|
315
320
|
}
|
|
316
|
-
function getFunctionReferences(currentUri, currentText, ast, analysis, offset, includeDeclaration, getOtherFiles, trimToLocalName = false) {
|
|
321
|
+
function getFunctionReferences(currentUri, currentText, ast, analysis, offset, includeDeclaration, getOtherFiles, loadAst, trimToLocalName = false) {
|
|
317
322
|
const occurrences = [];
|
|
318
323
|
walkFunctions(ast, analysis, occurrences);
|
|
319
324
|
const target = occurrences.find((o) => offset >= o.start && offset <= o.end);
|
|
@@ -328,10 +333,13 @@ function getFunctionReferences(currentUri, currentText, ast, analysis, offset, i
|
|
|
328
333
|
o,
|
|
329
334
|
}));
|
|
330
335
|
for (const file of getOtherFiles()) {
|
|
331
|
-
if (file.uri === currentUri || !file.
|
|
336
|
+
if (file.uri === currentUri || !file.text.includes(localName))
|
|
337
|
+
continue;
|
|
338
|
+
const fileAnalysis = loadAst(file.uri, file.text);
|
|
339
|
+
if (!fileAnalysis?.ast)
|
|
332
340
|
continue;
|
|
333
341
|
const fileOccs = [];
|
|
334
|
-
walkFunctions(
|
|
342
|
+
walkFunctions(fileAnalysis.ast, fileAnalysis, fileOccs);
|
|
335
343
|
for (const o of matches(fileOccs))
|
|
336
344
|
all.push({ uri: file.uri, text: file.text, o });
|
|
337
345
|
}
|
|
@@ -385,9 +393,11 @@ function prefixHasDeclaration(analysis, prefix) {
|
|
|
385
393
|
* Requires a valid AST (returns `[]` on the regex-fallback path, since parse
|
|
386
394
|
* failures don't produce reliable node positions).
|
|
387
395
|
* `getOtherFiles` is only invoked for symbol kinds that need a cross-file
|
|
388
|
-
* search, so callers can make it lazy.
|
|
396
|
+
* search, so callers can make it lazy. `getOtherFiles` returns lightweight,
|
|
397
|
+
* ast-free records for cheap candidate filtering; `loadAst` parses a specific
|
|
398
|
+
* candidate's full AST on demand once it survives that filter (see `LoadAst`).
|
|
389
399
|
*/
|
|
390
|
-
export function getReferences(currentUri, currentText, offset, analysis, includeDeclaration, getOtherFiles) {
|
|
400
|
+
export function getReferences(currentUri, currentText, offset, analysis, includeDeclaration, getOtherFiles, loadAst) {
|
|
391
401
|
const ast = analysis.ast;
|
|
392
402
|
if (!ast)
|
|
393
403
|
return [];
|
|
@@ -397,8 +407,8 @@ export function getReferences(currentUri, currentText, offset, analysis, include
|
|
|
397
407
|
if (target.kind === "prefix")
|
|
398
408
|
return getPrefixReferences(currentUri, currentText, ast, analysis, target.prefix, includeDeclaration);
|
|
399
409
|
if (target.kind === "variable")
|
|
400
|
-
return getVariableReferences(currentUri, currentText, ast, analysis, offset, includeDeclaration, getOtherFiles);
|
|
401
|
-
return getFunctionReferences(currentUri, currentText, ast, analysis, offset, includeDeclaration, getOtherFiles);
|
|
410
|
+
return getVariableReferences(currentUri, currentText, ast, analysis, offset, includeDeclaration, getOtherFiles, loadAst);
|
|
411
|
+
return getFunctionReferences(currentUri, currentText, ast, analysis, offset, includeDeclaration, getOtherFiles, loadAst);
|
|
402
412
|
}
|
|
403
413
|
/**
|
|
404
414
|
* Range of the renameable identifier at `offset`, trimmed to the local-name part
|
|
@@ -430,7 +440,7 @@ export function getRenameRangeAtOffset(currentText, offset, analysis) {
|
|
|
430
440
|
* recognizable at `offset`, or no resolvable local declaration (e.g. a builtin
|
|
431
441
|
* function or a predeclared runtime namespace prefix).
|
|
432
442
|
*/
|
|
433
|
-
export function getRenameLocations(currentUri, currentText, offset, analysis, getOtherFiles) {
|
|
443
|
+
export function getRenameLocations(currentUri, currentText, offset, analysis, getOtherFiles, loadAst) {
|
|
434
444
|
const ast = analysis.ast;
|
|
435
445
|
if (!ast)
|
|
436
446
|
return null;
|
|
@@ -443,8 +453,8 @@ export function getRenameLocations(currentUri, currentText, offset, analysis, ge
|
|
|
443
453
|
return getPrefixReferences(currentUri, currentText, ast, analysis, target.prefix, true);
|
|
444
454
|
}
|
|
445
455
|
const locs = target.kind === "variable"
|
|
446
|
-
? getVariableReferences(currentUri, currentText, ast, analysis, offset, true, getOtherFiles, true)
|
|
447
|
-
: getFunctionReferences(currentUri, currentText, ast, analysis, offset, true, getOtherFiles, true);
|
|
456
|
+
? getVariableReferences(currentUri, currentText, ast, analysis, offset, true, getOtherFiles, loadAst, true)
|
|
457
|
+
: getFunctionReferences(currentUri, currentText, ast, analysis, offset, true, getOtherFiles, loadAst, true);
|
|
448
458
|
return locs.length > 0 ? locs : null;
|
|
449
459
|
}
|
|
450
460
|
/**
|
|
@@ -116,6 +116,59 @@ declare function file:read-unicode($path as item()) as xs:string? external;
|
|
|
116
116
|
:)
|
|
117
117
|
declare function file:read-unicode($path as item(), $encoding as xs:string) as xs:string? external;
|
|
118
118
|
|
|
119
|
+
(:~
|
|
120
|
+
: Writes the node set into a file on the file system. $parameters contains a
|
|
121
|
+
: sequence of zero or more serialization parameters specified as key=value
|
|
122
|
+
: pairs. The serialization options are the same as those recognized by
|
|
123
|
+
: "declare option exist:serialize". The function does NOT automatically
|
|
124
|
+
: inherit the serialization options of the XQuery it is called from. This
|
|
125
|
+
: method is only available to the DBA role.
|
|
126
|
+
: @param $node-set The contents to write to the file system.
|
|
127
|
+
: @param $path The full path or URI to the file
|
|
128
|
+
: @param $parameters The serialization parameters: either a sequence of key=value pairs or an output:serialization-parameters element as defined by the standard fn:serialize function.
|
|
129
|
+
: @return true on success - false if the specified file can not be created or is not writable. The empty sequence is returned if the argument sequence is empty.
|
|
130
|
+
:)
|
|
131
|
+
declare function file:serialize($node-set as node()*, $path as item(), $parameters as item()*) as xs:boolean? external;
|
|
132
|
+
|
|
133
|
+
(:~
|
|
134
|
+
: Writes the node set into a file on the file system, optionally appending to
|
|
135
|
+
: it. $parameters contains a sequence of zero or more serialization parameters
|
|
136
|
+
: specified as key=value pairs. The serialization options are the same as
|
|
137
|
+
: those recognized by "declare option exist:serialize". The function does NOT
|
|
138
|
+
: automatically inherit the serialization options of the XQuery it is called
|
|
139
|
+
: from. This method is only available to the DBA role.
|
|
140
|
+
: @param $node-set The contents to write to the file system.
|
|
141
|
+
: @param $path The full path or URI to the file
|
|
142
|
+
: @param $parameters The serialization parameters: either a sequence of key=value pairs or an output:serialization-parameters element as defined by the standard fn:serialize function.
|
|
143
|
+
: @param $append Should content be appended?
|
|
144
|
+
: @return true on success - false if the specified file can not be created or is not writable. The empty sequence is returned if the argument sequence is empty.
|
|
145
|
+
:)
|
|
146
|
+
declare function file:serialize(
|
|
147
|
+
$node-set as node()*,
|
|
148
|
+
$path as item(),
|
|
149
|
+
$parameters as item()*,
|
|
150
|
+
$append as xs:boolean
|
|
151
|
+
) as xs:boolean? external;
|
|
152
|
+
|
|
153
|
+
(:~
|
|
154
|
+
: Writes binary data into a file on the file system. This method is only
|
|
155
|
+
: available to the DBA role.
|
|
156
|
+
: @param $binarydata The contents to write to the file system.
|
|
157
|
+
: @param $path The full path or URI to the file
|
|
158
|
+
: @return true on success - false if the specified file can not be created or is not writable
|
|
159
|
+
:)
|
|
160
|
+
declare function file:serialize-binary($binarydata as xs:base64Binary, $path as item()) as xs:boolean external;
|
|
161
|
+
|
|
162
|
+
(:~
|
|
163
|
+
: Writes binary data into a file on the file system, optionally appending the
|
|
164
|
+
: content. This method is only available to the DBA role.
|
|
165
|
+
: @param $binarydata The contents to write to the file system.
|
|
166
|
+
: @param $path The full path or URI to the file
|
|
167
|
+
: @param $append Should content be appended?
|
|
168
|
+
: @return true on success - false if the specified file can not be created or is not writable
|
|
169
|
+
:)
|
|
170
|
+
declare function file:serialize-binary($binarydata as xs:base64Binary, $path as item(), $append as xs:boolean) as xs:boolean external;
|
|
171
|
+
|
|
119
172
|
(:~
|
|
120
173
|
: Synchronize a collection with a directory hierarchy. This method is only
|
|
121
174
|
: available to the DBA role.
|
|
@@ -240,3 +240,19 @@ declare function request:is-multipart-content() as xs:boolean external;
|
|
|
240
240
|
: @param $value The attribute value
|
|
241
241
|
:)
|
|
242
242
|
declare function request:set-attribute($name as xs:string, $value as item()*) as empty-sequence() external;
|
|
243
|
+
: Returns the empty sequence if no item of $available is acceptable; the
|
|
244
|
+
: caller should then respond with 406 Not Acceptable.
|
|
245
|
+
: @param $available The media types the server can produce, in order of preference.
|
|
246
|
+
: @return the best matching media type, or the empty sequence if none is acceptable
|
|
247
|
+
:)
|
|
248
|
+
declare function request:negotiate-content-type($available as xs:string*) as xs:string? external;
|
|
249
|
+
|
|
250
|
+
(:~
|
|
251
|
+
: Returns $default if no item of $available is acceptable.
|
|
252
|
+
: @param $available The media types the server can produce, in order of preference.
|
|
253
|
+
: @param $default The media type to fall back to when no item of $available is acceptable.
|
|
254
|
+
: @return the best matching media type, or $default if none is acceptable
|
|
255
|
+
:)
|
|
256
|
+
declare function request:negotiate-content-type($available as xs:string*, $default as xs:string?) as xs:string? external;
|
|
257
|
+
|
|
258
|
+
(:~
|
|
@@ -13,18 +13,54 @@ declare function response:redirect-to($uri as xs:anyURI) as empty-sequence() ext
|
|
|
13
13
|
|
|
14
14
|
(:~
|
|
15
15
|
: Sets a HTTP Cookie on the HTTP Response.
|
|
16
|
+
: @param $name The cookie name
|
|
17
|
+
: @param $value The cookie value
|
|
16
18
|
:)
|
|
17
|
-
declare function response:set-cookie() as empty-sequence() external;
|
|
19
|
+
declare function response:set-cookie($name as xs:string, $value as xs:string) as empty-sequence() external;
|
|
20
|
+
|
|
21
|
+
(:~
|
|
22
|
+
: Sets a HTTP Cookie on the HTTP Response.
|
|
23
|
+
: @param $name The cookie name
|
|
24
|
+
: @param $value The cookie value
|
|
25
|
+
: @param $max-age The xs:duration of the cookie
|
|
26
|
+
:)
|
|
27
|
+
declare function response:set-cookie(
|
|
28
|
+
$name as xs:string,
|
|
29
|
+
$value as xs:string,
|
|
30
|
+
$max-age as xs:duration?,
|
|
31
|
+
$secure-flag as xs:boolean?
|
|
32
|
+
) as empty-sequence() external;
|
|
33
|
+
|
|
34
|
+
(:~
|
|
35
|
+
: Sets a HTTP Cookie on the HTTP Response.
|
|
36
|
+
: @param $name The cookie name
|
|
37
|
+
: @param $value The cookie value
|
|
38
|
+
: @param $max-age The xs:duration of the cookie
|
|
39
|
+
: @param $domain The cookie domain
|
|
40
|
+
: @param $path The cookie path
|
|
41
|
+
:)
|
|
42
|
+
declare function response:set-cookie(
|
|
43
|
+
$name as xs:string,
|
|
44
|
+
$value as xs:string,
|
|
45
|
+
$max-age as xs:duration?,
|
|
46
|
+
$secure-flag as xs:boolean?,
|
|
47
|
+
$domain as xs:string?,
|
|
48
|
+
$path as xs:string?
|
|
49
|
+
) as empty-sequence() external;
|
|
18
50
|
|
|
19
51
|
(:~
|
|
20
52
|
: Sets a HTTP Header on the HTTP Response.
|
|
53
|
+
: @param $name The header name
|
|
54
|
+
: @param $value The header value
|
|
21
55
|
:)
|
|
22
|
-
declare function response:set-date-header() as empty-sequence() external;
|
|
56
|
+
declare function response:set-date-header($name as xs:string, $value as xs:string) as empty-sequence() external;
|
|
23
57
|
|
|
24
58
|
(:~
|
|
25
59
|
: Sets a HTTP Header on the HTTP Response.
|
|
60
|
+
: @param $name The header name
|
|
61
|
+
: @param $value The header value
|
|
26
62
|
:)
|
|
27
|
-
declare function response:set-header() as empty-sequence() external;
|
|
63
|
+
declare function response:set-header($name as xs:string, $value as xs:string) as empty-sequence() external;
|
|
28
64
|
|
|
29
65
|
(:~
|
|
30
66
|
: Sets a HTTP server status code on the HTTP Response.
|
|
@@ -46,5 +82,22 @@ declare function response:stream($content as item()*, $serialization-options as
|
|
|
46
82
|
: ContentType HTTP header is set to the value given in $content-type. Note:
|
|
47
83
|
: the servlet output stream will be closed afterwards and mime-type settings
|
|
48
84
|
: in the prolog will not be passed.
|
|
85
|
+
: @param $binary-data The binary data to stream
|
|
86
|
+
: @param $content-type The ContentType HTTP header value
|
|
87
|
+
: @param $filename The filename. If provided, a Content-Disposition header is set for the filename in the HTTP Response
|
|
88
|
+
:)
|
|
89
|
+
declare function response:stream-binary($binary-data as xs:base64Binary, $content-type as xs:string, $filename as xs:string?) as empty-sequence() external;
|
|
90
|
+
|
|
91
|
+
(:~
|
|
92
|
+
: @param $binary-resource-path The path to the stored binary resource, e.g. /db/path/to/image.png
|
|
93
|
+
: @param $content-type The ContentType HTTP header value
|
|
94
|
+
:)
|
|
95
|
+
declare function response:stream-binary-resource($binary-resource-path as xs:string, $content-type as xs:string) as empty-sequence() external;
|
|
96
|
+
|
|
97
|
+
(:~
|
|
98
|
+
: A Content-Disposition header is set from $filename.
|
|
99
|
+
: @param $binary-resource-path The path to the stored binary resource, e.g. /db/path/to/image.png
|
|
100
|
+
: @param $content-type The ContentType HTTP header value
|
|
101
|
+
: @param $filename The filename. If provided, a Content-Disposition header is set for the filename in the HTTP Response
|
|
49
102
|
:)
|
|
50
|
-
declare function response:stream-binary() as empty-sequence() external;
|
|
103
|
+
declare function response:stream-binary-resource($binary-resource-path as xs:string, $content-type as xs:string, $filename as xs:string?) as empty-sequence() external;
|
|
@@ -33,3 +33,176 @@ declare function scheduler:pause-scheduled-job($job-name as xs:string) as xs:boo
|
|
|
33
33
|
: @return the indicator of successful resumption
|
|
34
34
|
:)
|
|
35
35
|
declare function scheduler:resume-scheduled-job($job-name as xs:string) as xs:boolean external;
|
|
36
|
+
|
|
37
|
+
(:~
|
|
38
|
+
: Schedules the Java Class named (the class must extend
|
|
39
|
+
: org.exist.scheduler.UserJavaJob) according to the Cron expression. The job
|
|
40
|
+
: will be registered using the job name.
|
|
41
|
+
: @param $java-classname The full name of the class to be executed. It must extend the org.exist.scheduler.UserJavaJob class.
|
|
42
|
+
: @param $cron-expression The cron expression. Please see the scheduler documentation.
|
|
43
|
+
: @param $job-name The name of the job.
|
|
44
|
+
:)
|
|
45
|
+
declare function scheduler:schedule-java-cron-job($java-classname as xs:string, $cron-expression as xs:string, $job-name as xs:string) as item()* external;
|
|
46
|
+
|
|
47
|
+
(:~
|
|
48
|
+
: Schedules the Java Class named (the class must extend
|
|
49
|
+
: org.exist.scheduler.UserJavaJob) according to the Cron expression. The job
|
|
50
|
+
: will be registered using the name passed in $job-name. The final argument
|
|
51
|
+
: can be used to specify parameters for the job, which will be passed to the
|
|
52
|
+
: query as external variables. Parameters are specified in an XML fragment
|
|
53
|
+
: with the following structure: <parameters><param name="param-name1"
|
|
54
|
+
: value="param-value1"/></parameters>.
|
|
55
|
+
: @param $java-classname The full name of the class to be executed. It must extend the org.exist.scheduler.UserJavaJob class.
|
|
56
|
+
: @param $cron-expression The cron expression. Please see the scheduler documentation.
|
|
57
|
+
: @param $job-name The name of the job.
|
|
58
|
+
: @param $job-parameters The XML fragment with the following structure: <parameters><param name="param-name1" value="param-value1"/></parameters>
|
|
59
|
+
:)
|
|
60
|
+
declare function scheduler:schedule-java-cron-job(
|
|
61
|
+
$java-classname as xs:string,
|
|
62
|
+
$cron-expression as xs:string,
|
|
63
|
+
$job-name as xs:string,
|
|
64
|
+
$job-parameters as element()?
|
|
65
|
+
) as item()* external;
|
|
66
|
+
|
|
67
|
+
(:~
|
|
68
|
+
: Schedules the Java Class named (the class must extend
|
|
69
|
+
: org.exist.scheduler.UserJavaJob) according to the periodic value. The job
|
|
70
|
+
: will be registered using the job name. The $job-parameters argument can be
|
|
71
|
+
: used to specify parameters for the job, which will be passed to the query as
|
|
72
|
+
: external variables. Parameters are specified in an XML fragment with the
|
|
73
|
+
: following structure: <parameters><param name="param-name1"
|
|
74
|
+
: value="param-value1"/></parameters>, Given the delay and the repeat.
|
|
75
|
+
: @param $java-classname The full name of the class to be executed. It must extend the org.exist.scheduler.UserJavaJob class.
|
|
76
|
+
: @param $period Time in milliseconds between execution of the job
|
|
77
|
+
: @param $job-name The name of the job.
|
|
78
|
+
: @param $job-parameters The XML fragment with the following structure: <parameters><param name="param-name1" value="param-value1"/></parameters>
|
|
79
|
+
: @param $delay The period in milliseconds to delay the start of a job.
|
|
80
|
+
: @param $repeat The number of times to repeat the job after the initial execution. A value of -1 means repeat forever.
|
|
81
|
+
:)
|
|
82
|
+
declare function scheduler:schedule-java-periodic-job(
|
|
83
|
+
$java-classname as xs:string,
|
|
84
|
+
$period as xs:integer,
|
|
85
|
+
$job-name as xs:string,
|
|
86
|
+
$job-parameters as element()?,
|
|
87
|
+
$delay as xs:integer,
|
|
88
|
+
$repeat as xs:integer
|
|
89
|
+
) as item()* external;
|
|
90
|
+
|
|
91
|
+
(:~
|
|
92
|
+
: Schedules the named XQuery resource (e.g. /db/foo.xql) according to the Cron
|
|
93
|
+
: expression. XQuery job's will be launched under the guest account initially,
|
|
94
|
+
: although the running XQuery may switch permissions through calls to
|
|
95
|
+
: xmldb:login(). The job will be registered using the job name. Jobs submitted
|
|
96
|
+
: via this function are transitory and will be lost on a server restart. To
|
|
97
|
+
: ensure the persistence of scheduled tasks add them to the conf.xml file.
|
|
98
|
+
: @param $xquery-resource The path to the XQuery resource
|
|
99
|
+
: @param $cron-expression The cron expression. Please see the scheduler documentation.
|
|
100
|
+
: @param $job-name The name of the job.
|
|
101
|
+
:)
|
|
102
|
+
declare function scheduler:schedule-xquery-cron-job($xquery-resource as xs:string, $cron-expression as xs:string, $job-name as xs:string) as item()* external;
|
|
103
|
+
|
|
104
|
+
(:~
|
|
105
|
+
: Schedules the named XQuery resource (e.g. /db/foo.xql) according to the Cron
|
|
106
|
+
: expression. XQuery job's will be launched under the guest account initially,
|
|
107
|
+
: although the running XQuery may switch permissions through calls to
|
|
108
|
+
: xmldb:login(). The job will be registered using the job name. The final
|
|
109
|
+
: argument can be used to specify parameters for the job, which will be passed
|
|
110
|
+
: to the query as external variables. Parameters are specified in an XML
|
|
111
|
+
: fragment with the following structure: <parameters><param name="param-name1"
|
|
112
|
+
: value="param-value1"/></parameters> Jobs submitted via this function are
|
|
113
|
+
: transitory and will be lost on a server restart. To ensure the persistence
|
|
114
|
+
: of scheduled tasks add them to the conf.xml file.
|
|
115
|
+
: @param $xquery-resource The path to the XQuery resource
|
|
116
|
+
: @param $cron-expression A cron expression. Please see the scheduler documentation.
|
|
117
|
+
: @param $job-name The name of the job.
|
|
118
|
+
: @param $job-parameters XML fragment with the following structure: <parameters><param name="param-name1" value="param-value1"/></parameters>
|
|
119
|
+
:)
|
|
120
|
+
declare function scheduler:schedule-xquery-cron-job(
|
|
121
|
+
$xquery-resource as xs:string,
|
|
122
|
+
$cron-expression as xs:string,
|
|
123
|
+
$job-name as xs:string,
|
|
124
|
+
$job-parameters as element()?
|
|
125
|
+
) as item()* external;
|
|
126
|
+
|
|
127
|
+
(:~
|
|
128
|
+
: Schedules the named XQuery resource (e.g. /db/foo.xql) according to the Cron
|
|
129
|
+
: expression. XQuery job's will be launched under the guest account initially,
|
|
130
|
+
: although the running XQuery may switch permissions through calls to
|
|
131
|
+
: xmldb:login(). The job will be registered using the job name. The job
|
|
132
|
+
: parameters argument can be used to specify parameters for the job, which
|
|
133
|
+
: will be passed to the query as external variables. Parameters are specified
|
|
134
|
+
: in an XML fragment with the following structure: <parameters><param
|
|
135
|
+
: name="param-name1" value="param-value1"/></parameters> Jobs submitted via
|
|
136
|
+
: this function are transitory and will be lost on a server restart. To ensure
|
|
137
|
+
: the persistence of scheduled tasks add them to the conf.xml file.
|
|
138
|
+
: @param $xquery-resource The path to the XQuery resource
|
|
139
|
+
: @param $cron-expression A cron expression. Please see the scheduler documentation.
|
|
140
|
+
: @param $job-name The name of the job.
|
|
141
|
+
: @param $job-parameters XML fragment with the following structure: <parameters><param name="param-name1" value="param-value1"/></parameters>
|
|
142
|
+
: @param $unschedule Specifies whether to unschedule this job if an XPathException is raised, default is true.
|
|
143
|
+
:)
|
|
144
|
+
declare function scheduler:schedule-xquery-cron-job(
|
|
145
|
+
$xquery-resource as xs:string,
|
|
146
|
+
$cron-expression as xs:string,
|
|
147
|
+
$job-name as xs:string,
|
|
148
|
+
$job-parameters as element()?,
|
|
149
|
+
$unschedule as xs:boolean
|
|
150
|
+
) as item()* external;
|
|
151
|
+
|
|
152
|
+
(:~
|
|
153
|
+
: Schedules the named XQuery resource (e.g. /db/foo.xql) according to the
|
|
154
|
+
: period. XQuery job's will be launched under the guest account initially,
|
|
155
|
+
: although the running XQuery may switch permissions through calls to
|
|
156
|
+
: xmldb:login(). The job will be registered using the job name. The job
|
|
157
|
+
: parameters argument can be used to specify parameters for the job, which
|
|
158
|
+
: will be passed to the query as external variables. Parameters are specified
|
|
159
|
+
: in an XML fragment with the following structure: <parameters><param
|
|
160
|
+
: name="param-name1" value="param-value1"/></parameters> , Given the delay
|
|
161
|
+
: passed and the repeat value. Jobs submitted via this function are transitory
|
|
162
|
+
: and will be lost on a server restart. To ensure the persistence of scheduled
|
|
163
|
+
: tasks add them to the conf.xml file.
|
|
164
|
+
: @param $xquery-resource The path to the XQuery resource
|
|
165
|
+
: @param $period Time in milliseconds between execution of the job
|
|
166
|
+
: @param $job-name The name of the job.
|
|
167
|
+
: @param $job-parameters XML fragment with the following structure: <parameters><param name="param-name1" value="param-value1"/></parameters>
|
|
168
|
+
: @param $delay Can be used with a period in milliseconds to delay the start of a job.
|
|
169
|
+
: @param $repeat Number of times to repeat the job after the initial execution. A value of -1 means repeat forever.
|
|
170
|
+
:)
|
|
171
|
+
declare function scheduler:schedule-xquery-periodic-job(
|
|
172
|
+
$xquery-resource as xs:string,
|
|
173
|
+
$period as xs:integer,
|
|
174
|
+
$job-name as xs:string,
|
|
175
|
+
$job-parameters as element()?,
|
|
176
|
+
$delay as xs:integer,
|
|
177
|
+
$repeat as xs:integer
|
|
178
|
+
) as item()* external;
|
|
179
|
+
|
|
180
|
+
(:~
|
|
181
|
+
: Schedules the named XQuery resource (e.g. /db/foo.xql) according to the
|
|
182
|
+
: period. XQuery job's will be launched under the guest account initially,
|
|
183
|
+
: although the running XQuery may switch permissions through calls to
|
|
184
|
+
: xmldb:login(). The job will be registered using the job name. The job
|
|
185
|
+
: parameters argument can be used to specify parameters for the job, which
|
|
186
|
+
: will be passed to the query as external variables. Parameters are specified
|
|
187
|
+
: in an XML fragment with the following structure: <parameters><param
|
|
188
|
+
: name="param-name1" value="param-value1"/></parameters> , Given the delay
|
|
189
|
+
: passed and the repeat value. Jobs submitted via this function are transitory
|
|
190
|
+
: and will be lost on a server restart. To ensure the persistence of scheduled
|
|
191
|
+
: tasks add them to the conf.xml file.
|
|
192
|
+
: @param $xquery-resource The path to the XQuery resource
|
|
193
|
+
: @param $period Time in milliseconds between execution of the job
|
|
194
|
+
: @param $job-name The name of the job.
|
|
195
|
+
: @param $job-parameters XML fragment with the following structure: <parameters><param name="param-name1" value="param-value1"/></parameters>
|
|
196
|
+
: @param $delay Can be used with a period in milliseconds to delay the start of a job.
|
|
197
|
+
: @param $repeat Number of times to repeat the job after the initial execution. A value of -1 means repeat forever.
|
|
198
|
+
: @param $unschedule Specifies whether to unschedule this job if an XPathException is raised, default is true.
|
|
199
|
+
:)
|
|
200
|
+
declare function scheduler:schedule-xquery-periodic-job(
|
|
201
|
+
$xquery-resource as xs:string,
|
|
202
|
+
$period as xs:integer,
|
|
203
|
+
$job-name as xs:string,
|
|
204
|
+
$job-parameters as element()?,
|
|
205
|
+
$delay as xs:integer,
|
|
206
|
+
$repeat as xs:integer,
|
|
207
|
+
$unschedule as xs:boolean
|
|
208
|
+
) as item()* external;
|