TKU und EDP Description and Autocomplete added
This commit is contained in:
parent
0063862a24
commit
43bb2fa250
File diff suppressed because one or more lines are too long
|
|
@ -1,5 +1,9 @@
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import { tplBuiltIns } from '../data/TplBuiltIns';
|
import { tplBuiltIns } from '../data/TplBuiltIns';
|
||||||
|
import { generatedTplBuiltIns } from '../data/GeneratedTplBuiltIns'; // Pfad ggf. anpassen
|
||||||
|
|
||||||
|
// Beide Datenquellen zusammenführen
|
||||||
|
const allTplFunctions: Record<string, any> = { ...tplBuiltIns, ...generatedTplBuiltIns };
|
||||||
|
|
||||||
export class TplHoverProvider implements vscode.HoverProvider {
|
export class TplHoverProvider implements vscode.HoverProvider {
|
||||||
public async provideHover(document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken): Promise<vscode.Hover | null> {
|
public async provideHover(document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken): Promise<vscode.Hover | null> {
|
||||||
|
|
@ -14,13 +18,13 @@ export class TplHoverProvider implements vscode.HoverProvider {
|
||||||
const importBase = parts[0];
|
const importBase = parts[0];
|
||||||
const funcName = parts.length > 1 ? parts[1] : word;
|
const funcName = parts.length > 1 ? parts[1] : word;
|
||||||
|
|
||||||
// 1. BMC BUILT-INS DYNAMISCH AUSLESEN
|
// 1. BMC BUILT-INS & TKU DEFINES DYNAMISCH AUSLESEN
|
||||||
const bmcNamespaces = Object.keys(tplBuiltIns);
|
const bmcNamespaces = Object.keys(allTplFunctions);
|
||||||
|
|
||||||
if (bmcNamespaces.includes(importBase)) {
|
if (bmcNamespaces.includes(importBase)) {
|
||||||
// Wenn die Methode in der Datei existiert, zeige die echte Doku!
|
// Wenn die Methode in der Datei existiert, zeige die echte Doku!
|
||||||
if (funcName !== importBase && tplBuiltIns[importBase][funcName]) {
|
if (funcName !== importBase && allTplFunctions[importBase][funcName]) {
|
||||||
const bmcDoc = tplBuiltIns[importBase][funcName];
|
const bmcDoc = allTplFunctions[importBase][funcName];
|
||||||
const md = new vscode.MarkdownString();
|
const md = new vscode.MarkdownString();
|
||||||
|
|
||||||
// Wir zeigen den echten Methodennamen als Code-Block
|
// Wir zeigen den echten Methodennamen als Code-Block
|
||||||
|
|
@ -30,7 +34,7 @@ export class TplHoverProvider implements vscode.HoverProvider {
|
||||||
return new vscode.Hover(md);
|
return new vscode.Hover(md);
|
||||||
}
|
}
|
||||||
// Fallback, wenn man nur über dem Namespace (z.B. "discovery") hovert
|
// Fallback, wenn man nur über dem Namespace (z.B. "discovery") hovert
|
||||||
return new vscode.Hover(new vscode.MarkdownString(`**${word}**\n\n*(BMC Built-in Namespace)*`));
|
return new vscode.Hover(new vscode.MarkdownString(`**${word}**\n\n*(BMC Built-in / TKU Namespace)*`));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Lokale Defines
|
// 2. Lokale Defines
|
||||||
|
|
@ -88,4 +92,4 @@ export class TplHoverProvider implements vscode.HoverProvider {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import { CompletionStrategy } from './CompletionStrategy';
|
import { CompletionStrategy } from './CompletionStrategy';
|
||||||
import { tplBuiltIns } from '../../data/TplBuiltIns';
|
import { tplBuiltIns } from '../../data/TplBuiltIns';
|
||||||
|
import { generatedTplBuiltIns } from '../../data/GeneratedTplBuiltIns'; // Pfad ggf. anpassen
|
||||||
|
|
||||||
|
const allTplFunctions: Record<string, any> = { ...tplBuiltIns, ...generatedTplBuiltIns };
|
||||||
|
|
||||||
export class LocalContextCompletion implements CompletionStrategy {
|
export class LocalContextCompletion implements CompletionStrategy {
|
||||||
public async provideCompletions(document: vscode.TextDocument, position: vscode.Position, linePrefix: string): Promise<vscode.CompletionItem[] | undefined> {
|
public async provideCompletions(document: vscode.TextDocument, position: vscode.Position, linePrefix: string): Promise<vscode.CompletionItem[] | undefined> {
|
||||||
|
|
@ -12,7 +15,8 @@ export class LocalContextCompletion implements CompletionStrategy {
|
||||||
if (dotMatch) {
|
if (dotMatch) {
|
||||||
const prefix = dotMatch[1];
|
const prefix = dotMatch[1];
|
||||||
|
|
||||||
const bmcNamespaces = Object.keys(tplBuiltIns);
|
// Auf erweitertes Dictionary prüfen
|
||||||
|
const bmcNamespaces = Object.keys(allTplFunctions);
|
||||||
if (bmcNamespaces.includes(prefix)) {
|
if (bmcNamespaces.includes(prefix)) {
|
||||||
return undefined; // Überlässt das Feld komplett der BuiltInCompletion!
|
return undefined; // Überlässt das Feld komplett der BuiltInCompletion!
|
||||||
}
|
}
|
||||||
|
|
@ -99,4 +103,4 @@ export class LocalContextCompletion implements CompletionStrategy {
|
||||||
}
|
}
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue