[mod] v0.0.64
This commit is contained in:
parent
52237c8267
commit
6d074b29c9
10 changed files with 64 additions and 46 deletions
13
CHANGELOG.md
13
CHANGELOG.md
|
@ -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
|
|
14
README.md
14
README.md
|
@ -1,9 +1,13 @@
|
||||||
# BaseX Tools for Visual Studio Code
|
# 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
|
The vscode-basex extension adds features to support BaseX development on VSCode.
|
||||||
* XQuery code format
|
For XQuery
|
||||||
|
* Grammar support for:XQuery 3.1, XQuery update, Full text syntax
|
||||||
|
* code format
|
||||||
|
* code completion
|
||||||
|
* code snippets
|
||||||
|
* outline symbol view
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
* [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)
|
||||||
|
@ -40,4 +44,4 @@ Icons used in the XML Tree View are used under the Creative Commons 3.0 BY licen
|
||||||
|
|
||||||
## Inspiration
|
## 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.
|
|
@ -1,20 +1,11 @@
|
||||||
{
|
{
|
||||||
"comments": {
|
"comments": {
|
||||||
"lineComment": ["(:", ":)"],
|
"lineComment": ["(:", ":)"],
|
||||||
"blockComment": [ "(:~", "~:)"]
|
"blockComment": [ "(:", ":)"]
|
||||||
},
|
},
|
||||||
"brackets": [
|
"brackets": [
|
||||||
[
|
[ "{", "}" ],
|
||||||
"{",
|
[ "[", "]" ],
|
||||||
"}"
|
[ "(", ")" ]
|
||||||
],
|
|
||||||
[
|
|
||||||
"[",
|
|
||||||
"]"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"(",
|
|
||||||
")"
|
|
||||||
]
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"name": "vscode-basex",
|
"name": "vscode-basex",
|
||||||
"displayName": "BaseX tools",
|
"displayName": "BaseX tools",
|
||||||
"description": "BaseX tools: XQuery, XML, XPath Tools for Visual Studio Code",
|
"description": "BaseX tools: XQuery, XML, XPath Tools for Visual Studio Code",
|
||||||
"version": "0.0.63",
|
"version": "0.0.64",
|
||||||
"preview": true,
|
"preview": true,
|
||||||
"publisher": "quodatum",
|
"publisher": "quodatum",
|
||||||
"author": "Andy Bunce (https://github.com/Quodatum)",
|
"author": "Andy Bunce (https://github.com/Quodatum)",
|
||||||
|
|
18
src/@quodatum/xqlint.d.ts
vendored
18
src/@quodatum/xqlint.d.ts
vendored
|
@ -2,15 +2,25 @@ declare module '@quodatum/xqlint'{
|
||||||
export class XQLint{
|
export class XQLint{
|
||||||
constructor(source :string, opts? :object);
|
constructor(source :string, opts? :object);
|
||||||
public getCompletions(pos :object): [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{
|
export class XQDoc{
|
||||||
moduleNamespace: string;
|
moduleNamespace: string;
|
||||||
description: string;
|
description: string;
|
||||||
variables: [object];
|
variables: [VarType];
|
||||||
functions: [object];
|
functions: [FunType];
|
||||||
}
|
}
|
||||||
export function XQueryLexer() :any;
|
export function XQueryLexer() :any;
|
||||||
export function createStaticContext(processor :string) :any;
|
export function createStaticContext(processor :string) :any;
|
||||||
export function CodeFormatter(ast :object) :any;
|
export function CodeFormatter(ast :object) :any;
|
||||||
export function CodeFormatter(ast :object, newLinesEnabled :boolean, DEBUG :any) :any;
|
export function CodeFormatter(ast :object, newLinesEnabled :boolean, DEBUG :any) :any;
|
||||||
|
|
|
@ -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
|
|
|
@ -16,6 +16,7 @@ import { executeXQuery } from "./xquery-execution/commands";
|
||||||
import * as constants from "./constants";
|
import * as constants from "./constants";
|
||||||
import { XQueryFormatter } from "./formatting/xquery-formatting-provider";
|
import { XQueryFormatter } from "./formatting/xquery-formatting-provider";
|
||||||
import { Symbols } from './symbols/symbols';
|
import { Symbols } from './symbols/symbols';
|
||||||
|
import { XQueryHoverProvider } from './hover/hover';
|
||||||
|
|
||||||
let diagnosticCollectionXQuery: DiagnosticCollection;
|
let diagnosticCollectionXQuery: DiagnosticCollection;
|
||||||
|
|
||||||
|
@ -53,6 +54,9 @@ export function activate(context: ExtensionContext) {
|
||||||
// symbols
|
// symbols
|
||||||
const symbols = new Symbols();
|
const symbols = new Symbols();
|
||||||
context.subscriptions.push(languages.registerDocumentSymbolProvider(constants.languageIds.xquery, 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 */
|
/* Linting Features */
|
||||||
diagnosticCollectionXQuery = languages.createDiagnosticCollection(constants.diagnosticCollections.xquery);
|
diagnosticCollectionXQuery = languages.createDiagnosticCollection(constants.diagnosticCollections.xquery);
|
||||||
|
|
|
@ -9,8 +9,8 @@ export class ClassicXmlFormatter implements XmlFormatter {
|
||||||
|
|
||||||
if (options.splitXmlnsOnFormat) {
|
if (options.splitXmlnsOnFormat) {
|
||||||
xml = xml
|
xml = xml
|
||||||
.replace(/xmlns\:/g, "~::~xmlns:")
|
.replace(/xmlns:/g, "~::~xmlns:")
|
||||||
.replace(/xmlns\=/g, "~::~xmlns=");
|
.replace(/xmlns=/g, "~::~xmlns=");
|
||||||
}
|
}
|
||||||
|
|
||||||
const parts: string[] = xml.split("~::~");
|
const parts: string[] = xml.split("~::~");
|
||||||
|
|
17
src/hover/hover.ts
Normal file
17
src/hover/hover.ts
Normal 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
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||||
import { XQLint } from '@quodatum/xqlint';
|
import { VarType, FunType, XQLint } from '@quodatum/xqlint';
|
||||||
import {SymbolKind, DocumentSymbol, DocumentSymbolProvider,
|
import {SymbolKind, DocumentSymbol, DocumentSymbolProvider,
|
||||||
Range, Position, TextDocument,CancellationToken} from 'vscode';
|
Range, Position, TextDocument,CancellationToken} from 'vscode';
|
||||||
import { channel } from "../common/logger";
|
import { channel } from "../common/logger";
|
||||||
//
|
//
|
||||||
// This class handles Symbols
|
// This class handles XQuery Symbols
|
||||||
//
|
//
|
||||||
function makeSymbol(name: string, description: string, icon: SymbolKind, pos: any) {
|
function makeSymbol(name: string, description: string, icon: SymbolKind, pos: any) {
|
||||||
const spos = new Position(pos.sl, pos.sc);
|
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);
|
const selrange = new Range(spos, spos);
|
||||||
return new DocumentSymbol(name, description, icon, fullrange, selrange);
|
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 {
|
export class Symbols implements DocumentSymbolProvider {
|
||||||
provideDocumentSymbols = async (
|
provideDocumentSymbols = async (
|
||||||
|
|
Loading…
Add table
Reference in a new issue