[mod] v0.0.64

This commit is contained in:
Andy Bunce 2023-01-26 11:32:14 +00:00
parent 52237c8267
commit 6d074b29c9
10 changed files with 64 additions and 46 deletions

View File

@ -1,4 +1,11 @@
Detailed release notes are available [here](https://git.quodatum.duckdns.org/apb/vscode-basex/releases).
# 0.0.64 (2023-01-26)
* add simple hover display
* Update `xqlint.d.ts` to support newer `tsc.exe`. This reduces size of vsix from 600kb to 300kb
# 0.0.58
* use xqlint 0.0.14
# 0.0.48
* Fix xmlToText #6
* FIX outline all vars
* 0.0.54
* 0.0.52 typescript fixes

View File

@ -1,9 +1,13 @@
# BaseX Tools for Visual Studio Code
This project was originally a fork of https://github.com/DotJoshJohnson/vscode-xml
This extension adds features to support BaseX development on VSCode.
* XQuery 3.1, XQuery update, Full text syntax support
* XQuery code format
The vscode-basex extension adds features to support BaseX development on VSCode.
For XQuery
* Grammar support for:XQuery 3.1, XQuery update, Full text syntax
* code format
* code completion
* code snippets
* outline symbol view
## Features
* [XML Formatting](https://git.quodatum.duckdns.org/apb/vscode-basex/wiki/xml-formatting)
@ -40,4 +44,4 @@ Icons used in the XML Tree View are used under the Creative Commons 3.0 BY licen
## Inspiration
This is built on a fork of [DotJoshJohnson/vscode-xml](https://github.com/DotJoshJohnson/vscode-xml).
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

@ -1,20 +1,11 @@
{
"comments": {
"lineComment": ["(:", ":)"],
"blockComment": [ "(:~", "~:)"]
"blockComment": [ "(:", ":)"]
},
"brackets": [
[
"{",
"}"
],
[
"[",
"]"
],
[
"(",
")"
]
[ "{", "}" ],
[ "[", "]" ],
[ "(", ")" ]
]
}

View File

@ -2,7 +2,7 @@
"name": "vscode-basex",
"displayName": "BaseX tools",
"description": "BaseX tools: XQuery, XML, XPath Tools for Visual Studio Code",
"version": "0.0.63",
"version": "0.0.64",
"preview": true,
"publisher": "quodatum",
"author": "Andy Bunce (https://github.com/Quodatum)",

View File

@ -2,13 +2,23 @@ declare module '@quodatum/xqlint'{
export class XQLint{
constructor(source :string, opts? :object);
public getCompletions(pos :object): [object];
public getXQDoc() :XQdoc;
public getXQDoc() :XQDoc;
}
export interface VarType {
name: string;
pos: any;
}
export interface FunType {
name: string;
params: string[]; // name
pos: boolean;
}
export class XQDoc{
moduleNamespace: string;
description: string;
variables: [object];
functions: [object];
variables: [VarType];
functions: [FunType];
}
export function XQueryLexer() :any;
export function createStaticContext(processor :string) :any;

View File

@ -1,7 +0,0 @@
# 0.0.58
* use xqlint 0.0.14
# 0.0.48
* Fix xmlToText #6
* FIX outline all vars
# 0.0.47

View File

@ -16,6 +16,7 @@ import { executeXQuery } from "./xquery-execution/commands";
import * as constants from "./constants";
import { XQueryFormatter } from "./formatting/xquery-formatting-provider";
import { Symbols } from './symbols/symbols';
import { XQueryHoverProvider } from './hover/hover';
let diagnosticCollectionXQuery: DiagnosticCollection;
@ -53,6 +54,9 @@ export function activate(context: ExtensionContext) {
// symbols
const symbols = new Symbols();
context.subscriptions.push(languages.registerDocumentSymbolProvider(constants.languageIds.xquery, symbols));
// hover
const hover = new XQueryHoverProvider();
context.subscriptions.push(languages.registerHoverProvider(constants.languageIds.xquery, hover));
/* Linting Features */
diagnosticCollectionXQuery = languages.createDiagnosticCollection(constants.diagnosticCollections.xquery);

View File

@ -9,8 +9,8 @@ export class ClassicXmlFormatter implements XmlFormatter {
if (options.splitXmlnsOnFormat) {
xml = xml
.replace(/xmlns\:/g, "~::~xmlns:")
.replace(/xmlns\=/g, "~::~xmlns=");
.replace(/xmlns:/g, "~::~xmlns:")
.replace(/xmlns=/g, "~::~xmlns=");
}
const parts: string[] = xml.split("~::~");

17
src/hover/hover.ts Normal file
View File

@ -0,0 +1,17 @@
// xquery hover
import { CancellationToken, Hover, HoverProvider, Position, TextDocument } from "vscode";
import { channel } from "../common/logger";
export class XQueryHoverProvider implements HoverProvider {
public provideHover(
document: TextDocument,
position: Position,
token: CancellationToken
): Hover | null {
const range = document.getWordRangeAtPosition(position);
const word = document.getText(range);
return new Hover(`Hover info: ${word} at ${position.line}: ${position.character}`);
// return null; if there is no information to show
}
}

View File

@ -1,10 +1,10 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import { XQLint } from '@quodatum/xqlint';
import { VarType, FunType, XQLint } from '@quodatum/xqlint';
import {SymbolKind, DocumentSymbol, DocumentSymbolProvider,
Range, Position, TextDocument,CancellationToken} from 'vscode';
import { channel } from "../common/logger";
//
// This class handles Symbols
// This class handles XQuery Symbols
//
function makeSymbol(name: string, description: string, icon: SymbolKind, pos: any) {
const spos = new Position(pos.sl, pos.sc);
@ -13,15 +13,7 @@ function makeSymbol(name: string, description: string, icon: SymbolKind, pos: an
const selrange = new Range(spos, spos);
return new DocumentSymbol(name, description, icon, fullrange, selrange);
}
export type VarType = {
name: string;
pos: any;
};
export type FunType = {
name: string;
params: string[]; // name
pos: boolean;
};
export class Symbols implements DocumentSymbolProvider {
provideDocumentSymbols = async (