[mod] tidy

This commit is contained in:
Andy Bunce 2023-02-20 10:17:47 +00:00
parent 8d47e56dfa
commit 6e5d06b871
3 changed files with 14 additions and 9 deletions

View File

@ -1,5 +1,5 @@
# 0.1.0 (2023-02-19) # 0.1.0 (2023-02-19)
Update xqlint 0.2.0 Update xqlint to 0.2.0
# 0.0.64 (2023-01-26) # 0.0.64 (2023-01-26)
* add simple hover display * add simple hover display

View File

@ -13,6 +13,7 @@ For XQuery
* [XQuery Linting](https://git.quodatum.duckdns.org/apb/vscode-basex/wiki/xquery-linting) * [XQuery Linting](https://git.quodatum.duckdns.org/apb/vscode-basex/wiki/xquery-linting)
* [XQuery Code Completion](https://git.quodatum.duckdns.org/apb/vscode-basex/wiki/xquery-code-completion) * [XQuery Code Completion](https://git.quodatum.duckdns.org/apb/vscode-basex/wiki/xquery-code-completion)
* [XQuery Execution](https://git.quodatum.duckdns.org/apb/vscode-basex/wiki/xquery-script-execution) * [XQuery Execution](https://git.quodatum.duckdns.org/apb/vscode-basex/wiki/xquery-script-execution)
* [XQuery source formating](https://git.quodatum.duckdns.org/apb/vscode-basex/wiki/xquery-source-formating)
* [XML Formatting](https://git.quodatum.duckdns.org/apb/vscode-basex/wiki/xml-formatting) * [XML Formatting](https://git.quodatum.duckdns.org/apb/vscode-basex/wiki/xml-formatting)
* [XML Tree View](https://git.quodatum.duckdns.org/apb/vscode-basex/wiki/xml-tree-view) * [XML Tree View](https://git.quodatum.duckdns.org/apb/vscode-basex/wiki/xml-tree-view)
@ -39,11 +40,16 @@ npm install --global vsce
npm run compile npm run compile
vsce package vsce package
``` ```
## Inspiration
This project was created from a fork of [DotJoshJohnson/vscode-xml](https://github.com/DotJoshJohnson/vscode-xml). Much of `DotJoshJohnson/vscode-xml` code dealing with XML has been removed and additional XQuery features added.
The code parsing uses [quodatum/xqlint] which is based on [wcandillon/xqlint]
## 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
* "At" icon by FreePik from www.flaticon.com * "At" icon by FreePik from www.flaticon.com
## Inspiration
This project was created from a fork of [DotJoshJohnson/vscode-xml](https://github.com/DotJoshJohnson/vscode-xml). Much of `DotJoshJohnson/vscode-xml` code dealing with XML has been removed and additional XQuery features added.

View File

@ -2,7 +2,6 @@
import { CancellationToken, Hover, HoverProvider, Position, TextDocument } from "vscode"; import { CancellationToken, Hover, HoverProvider, Position, TextDocument } from "vscode";
import { XQLint} from "@quodatum/xqlint"; import { XQLint} from "@quodatum/xqlint";
import { channel,dump } from "../common/logger";
export class XQueryHoverProvider implements HoverProvider { export class XQueryHoverProvider implements HoverProvider {
public provideHover( public provideHover(
@ -11,16 +10,16 @@ export class XQueryHoverProvider implements HoverProvider {
token: CancellationToken token: CancellationToken
): Hover | null { ): Hover | null {
const linter = new XQLint(document.getText()); const linter = new XQLint(document.getText());
const posx=position.translate(1,1); //@TODO
const node=linter.getAST(posx); const node=linter.getAST(position);
const sctx=linter.getCompletions(posx); //const sctx=linter.getCompletions(position);
channel.log("Hover: " + node.name); //channel.log("Hover: " + node.name);
//const dx=dump(node); //const dx=dump(node);
//channel.appendLine(dx); //channel.appendLine(dx);
const range = document.getWordRangeAtPosition(position); const range = document.getWordRangeAtPosition(position);
const word = document.getText(range); const word = document.getText(range);
return new Hover(`XQuery Hover info: ${word} at ${posx.line}: ${posx.character} return new Hover(`XQuery Hover info: ${word} at ${position.line}: ${position.character}
value: ${ node.value }, name: ${ node.name } value: ${ node.value }, name: ${ node.name }
`); `);