ifc-language-server/client/node_modules/vscode-languageclient/lib/common/notebook.d.ts
Ryan Schultz 8afacf268a Implemented a working Language Server Protocol (LSP) for IFC files with:
- Hover provider showing entity information and type
- Go-to-definition (F12) for entity references
- Basic IFC file validation (ISO-10303-21 header check)
- Entity parsing with regex-based detection
- Proper CommonJS module system (avoiding ES module issues)

This replaces the broken baseline from ifc-developer-tools which had:
- Non-functional ES module configuration
- Circular dependency issues
- Parser crashes
- Non-working PositionVisitor

Built on Microsoft's LSP example template for a clean, maintainable foundation.

Next: Add hierarchical entity dependency tree in hover tooltip."
2025-12-07 10:20:07 -06:00

96 lines
4.2 KiB
TypeScript

import * as vscode from 'vscode';
import * as proto from 'vscode-languageserver-protocol';
import { NotebookCellTextDocumentFilter } from 'vscode-languageserver-protocol';
import { DynamicFeature, FeatureClient, RegistrationData, FeatureState } from './features';
export type VNotebookDocumentChangeEvent = {
/**
* The notebook document
*/
notebook: vscode.NotebookDocument;
/**
* The changed meta data if any.
*/
metadata?: {
[key: string]: any;
};
/**
* Changes to cells.
*/
cells?: {
/**
* Changes to the cell structure to add or
* remove cells.
*/
structure?: {
/**
* The change to the cell array.
*/
array: {
start: number;
deleteCount: number;
cells?: vscode.NotebookCell[];
};
/**
* Additional opened cell text documents.
*/
didOpen?: vscode.NotebookCell[];
/**
* Additional closed cell text documents.
*/
didClose?: vscode.NotebookCell[];
};
/**
* Changes to notebook cells properties like its
* kind or metadata.
*/
data?: vscode.NotebookCell[];
/**
* Changes to the text content of notebook cells.
*/
textContent?: vscode.TextDocumentChangeEvent[];
};
};
export type NotebookDocumentOptions = {
filterCells?(notebookDocument: vscode.NotebookDocument, cells: vscode.NotebookCell[]): vscode.NotebookCell[];
};
export type $NotebookDocumentOptions = {
notebookDocumentOptions?: NotebookDocumentOptions;
};
export type NotebookDocumentMiddleware = {
notebooks?: {
didOpen?: (this: void, notebookDocument: vscode.NotebookDocument, cells: vscode.NotebookCell[], next: (this: void, notebookDocument: vscode.NotebookDocument, cells: vscode.NotebookCell[]) => Promise<void>) => Promise<void>;
didSave?: (this: void, notebookDocument: vscode.NotebookDocument, next: (this: void, notebookDocument: vscode.NotebookDocument) => Promise<void>) => Promise<void>;
didChange?: (this: void, event: VNotebookDocumentChangeEvent, next: (this: void, event: VNotebookDocumentChangeEvent) => Promise<void>) => Promise<void>;
didClose?: (this: void, notebookDocument: vscode.NotebookDocument, cells: vscode.NotebookCell[], next: (this: void, notebookDocument: vscode.NotebookDocument, cells: vscode.NotebookCell[]) => Promise<void>) => Promise<void>;
};
};
export interface NotebookDocumentSyncFeatureShape {
sendDidOpenNotebookDocument(notebookDocument: vscode.NotebookDocument): Promise<void>;
sendDidSaveNotebookDocument(notebookDocument: vscode.NotebookDocument): Promise<void>;
sendDidChangeNotebookDocument(event: VNotebookDocumentChangeEvent): Promise<void>;
sendDidCloseNotebookDocument(notebookDocument: vscode.NotebookDocument): Promise<void>;
}
export type $NotebookCellTextDocumentFilter = NotebookCellTextDocumentFilter & {
sync: true;
};
export type NotebookDocumentProviderShape = {
getProvider(notebookCell: vscode.NotebookCell): NotebookDocumentSyncFeatureShape | undefined;
};
export declare class NotebookDocumentSyncFeature implements DynamicFeature<proto.NotebookDocumentSyncRegistrationOptions>, NotebookDocumentProviderShape {
static readonly CellScheme: string;
private readonly client;
private readonly registrations;
private dedicatedChannel;
constructor(client: FeatureClient<NotebookDocumentMiddleware, $NotebookDocumentOptions>);
getState(): FeatureState;
readonly registrationType: proto.RegistrationType<proto.NotebookDocumentSyncRegistrationOptions>;
fillClientCapabilities(capabilities: proto.ClientCapabilities): void;
preInitialize(capabilities: proto.ServerCapabilities<any>): void;
initialize(capabilities: proto.ServerCapabilities<any>): void;
register(data: RegistrationData<proto.NotebookDocumentSyncRegistrationOptions>): void;
unregister(id: string): void;
clear(): void;
handles(textDocument: vscode.TextDocument): boolean;
getProvider(notebookCell: vscode.NotebookCell): NotebookDocumentSyncFeatureShape | undefined;
private findNotebookDocumentAndCell;
}