[mod] v0.0.64
This commit is contained in:
parent
52237c8267
commit
6d074b29c9
10 changed files with 64 additions and 46 deletions
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{
|
||||
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 XQueryLexer() :any;
|
||||
export function createStaticContext(processor :string) :any;
|
||||
export function CodeFormatter(ast :object) :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 { 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);
|
||||
|
|
|
|||
|
|
@ -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
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 */
|
||||
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 (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue