[fix] typescript

This commit is contained in:
Andy Bunce 2022-06-12 16:20:17 +01:00
parent a0b3d96f38
commit b3f47dc553
5 changed files with 5938 additions and 2443 deletions

View file

@ -1,4 +1,4 @@
Detailed release notes are available [here](https://github.com/DotJoshJohnson/vscode-xml/releases). Detailed release notes are available [here](https://git.quodatum.duckdns.org/apb/vscode-basex/releases).
0.0.27 doc format * 0.0.54
0.0.4 [add] treat schematron (.sch) as XML * 0.0.52 typescript fixes

View file

@ -6,22 +6,31 @@ This extension adds features to support BaseX development on VSCode.
* XQuery code format * XQuery code format
## Features ## Features
* [XML Formatting](https://github.com/DotJoshJohnson/vscode-xml/wiki/xml-formatting) * [XML Formatting](https://git.quodatum.duckdns.org/apb/vscode-basex/wiki/xml-formatting)
* [XML Tree View](https://github.com/DotJoshJohnson/vscode-xml/wiki/xml-tree-view) * [XML Tree View](https://git.quodatum.duckdns.org/apb/vscode-basex/wiki/xml-tree-view)
* [XPath Evaluation](https://github.com/DotJoshJohnson/vscode-xml/wiki/xpath-evaluation) * [XPath Evaluation](https://git.quodatum.duckdns.org/apb/vscode-basex/wiki/xpath-evaluation)
* [XQuery Linting](https://github.com/DotJoshJohnson/vscode-xml/wiki/xquery-linting) * [XQuery Linting](https://git.quodatum.duckdns.org/apb/vscode-basex/wiki/xquery-linting)
* [XQuery Execution](https://github.com/DotJoshJohnson/vscode-xml/wiki/xquery-script-execution) * [XQuery Execution](https://git.quodatum.duckdns.org/apb/vscode-basex/wiki/xquery-script-execution)
* [XQuery Code Completion](https://github.com/DotJoshJohnson/vscode-xml/wiki/xquery-code-completion) * [XQuery Code Completion](https://git.quodatum.duckdns.org/apb/vscode-basex/wiki/xquery-code-completion)
## Requirements ## Requirements
* VS Code `1.63.0` or higher * VS Code `1.63.0` or higher
## Release Notes ## Release Notes
Detailed release notes are available [here](https://github.com/DotJoshJohnson/vscode-xml/releases). Detailed release notes are available [here](https://git.quodatum.duckdns.org/apb/vscode-basex/releases).
## Issues ## Issues
Run into a bug? Report it [here](https://github.com/DotJoshJohnson/vscode-xml/issues). Run into a bug? Report it [here](https://git.quodatum.duckdns.org/apb/vscode-basex/issues).
## build
```
npm install
npm install -g typescript #maybe
npm install --global vsce
#
npm run compile
vsce package
```
## Icon Credits ## Icon Credits
Icons used in the XML Tree View are used under the Creative Commons 3.0 BY license. Icons used in the XML Tree View are used under the Creative Commons 3.0 BY license.
* "Code" icon by Dave Gandy from www.flaticon.com * "Code" icon by Dave Gandy from www.flaticon.com
@ -29,4 +38,4 @@ Icons used in the XML Tree View are used under the Creative Commons 3.0 BY licen
## Inspiration ## Inspiration
This is a fork of [DotJoshJohnson/vscode-xml](https://github.com/DotJoshJohnson/vscode-xml). DotJoshJohnson did the intial work, but I want to go in a different direction. This is built on a fork of [DotJoshJohnson/vscode-xml](https://github.com/DotJoshJohnson/vscode-xml).

8308
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -81,7 +81,6 @@
{ {
"id": "xmltree", "id": "xmltree",
"title": "XML tree view ", "title": "XML tree view ",
"properties": { "properties": {
"basexTools.xmlTree.enableTreeView": { "basexTools.xmlTree.enableTreeView": {
"type": "boolean", "type": "boolean",
@ -106,7 +105,7 @@
{ {
"id": "xpath", "id": "xpath",
"title": "XPath ", "title": "XPath ",
"properties":{ "properties": {
"basexTools.xpath.ignoreDefaultNamespace": { "basexTools.xpath.ignoreDefaultNamespace": {
"type": "boolean", "type": "boolean",
"default": true, "default": true,
@ -119,11 +118,12 @@
"description": "Remember the last XPath query used.", "description": "Remember the last XPath query used.",
"scope": "window" "scope": "window"
} }
} }
},{ },
{
"id": "xquery", "id": "xquery",
"title": "XQuery ", "title": "XQuery ",
"properties":{ "properties": {
"basexTools.xquery.executionArguments": { "basexTools.xquery.executionArguments": {
"type": "array", "type": "array",
"default": [ "default": [
@ -156,8 +156,8 @@
"scope": "window" "scope": "window"
} }
} }
},
},{ {
"title": "BaseX Tools ", "title": "BaseX Tools ",
"type": "object", "type": "object",
"properties": { "properties": {
@ -167,7 +167,6 @@
"description": "Enforces a space before the forward slash at the end of a self-closing XML tag.", "description": "Enforces a space before the forward slash at the end of a self-closing XML tag.",
"scope": "resource" "scope": "resource"
}, },
"basexTools.removeCommentsOnMinify": { "basexTools.removeCommentsOnMinify": {
"type": "boolean", "type": "boolean",
"default": false, "default": false,
@ -196,7 +195,7 @@
"description": "Supported XML Formatters: classic", "description": "Supported XML Formatters: classic",
"scope": "window" "scope": "window"
} }
} }
} }
], ],
"grammars": [ "grammars": [
@ -314,11 +313,11 @@
"eslint": "^8.10.0", "eslint": "^8.10.0",
"glob": "^7.2.0", "glob": "^7.2.0",
"mocha": "^9.2.1", "mocha": "^9.2.1",
"typescript": "^4.6.2" "typescript": "^4.7.3"
}, },
"dependencies": { "dependencies": {
"@quodatum/xqlint": "^0.0.11", "@quodatum/xqlint": "^0.0.11",
"@xmldom/xmldom": "^0.8.1", "@xmldom/xmldom": "^0.8.1",
"xpath": "0.0.32" "xpath": "0.0.32"
} }
} }

View file

@ -13,6 +13,15 @@ function makeSymbol(name: string, description: string, icon: SymbolKind, pos: an
const selrange = new Range(spos, spos); const selrange = new Range(spos, spos);
return new DocumentSymbol(name, description, icon, fullrange, selrange); return new DocumentSymbol(name, description, icon, fullrange, selrange);
} }
export type VarTypes = {
name: string;
pos: any;
};
export type FunTypes = {
name: string;
params: any; //@todo
pos: boolean;
};
export class Symbols implements DocumentSymbolProvider { export class Symbols implements DocumentSymbolProvider {
provideDocumentSymbols = async ( provideDocumentSymbols = async (
@ -36,17 +45,17 @@ export class Symbols implements DocumentSymbolProvider {
// pos: pos, // pos: pos,
// qname: qname, // qname: qname,
// annotations: {} // annotations: {}
xqdoc.variables.forEach(v => { xqdoc.variables.forEach(function (v: VarTypes): void {
const name = v.name; const name = v.name;
const info = makeSymbol(name, "", SymbolKind.Variable, v.pos) const info = makeSymbol(name, "", SymbolKind.Variable, v.pos);
vars.children.push(info); vars.children.push(info);
}); });
const funs=makeSymbol("Variables", "", SymbolKind.Function, prolog) const funs=makeSymbol("Variables", "", SymbolKind.Function, prolog)
funs.children=[] funs.children=[]
xqdoc.functions.forEach(v => { xqdoc.functions.forEach(function (f: FunTypes) {
const name = v.name +"#" + v.params.length; const name = f.name + "#" + f.params.length;
const info = makeSymbol(name, "", SymbolKind.Function, v.pos) const info = makeSymbol(name, "", SymbolKind.Function, f.pos);
funs.children.push(info); funs.children.push(info);
}); });
symbols.push(vars) symbols.push(vars)