or run

npx @tessl/cli init
Log in

Version

Files

tile.json

task.mdevals/scenario-1/

Workspace LSP Activation

Create a JupyterLab extension module that turns on the built-in Language Server Protocol service (disabled by default) and exposes a thin API for registering language servers plus querying diagnostics, completions, and definition locations for notebooks or text editors. The solution should rely on the existing service instead of implementing the protocol manually.

Capabilities

Activate and register servers

  • Calling the activation API with Python and Markdown server configs toggles the LSP service on (if it was off) and registers both servers under their language identifiers. @test
  • Repeating activation with the same configs does not spawn duplicate server sessions and leaves the service ready. @test

Diagnostics and completions

  • Given a Python file path and code containing an obvious syntax error, requesting diagnostics returns at least one diagnostic that includes the error message and its line/column. @test
  • Given Python code where the cursor sits inside the prefix pri, requesting completions returns suggestions that include print. @test

Go-to-definition

  • When a symbol has been defined earlier in the same document, requesting a definition target returns a URI or path that points to that definition location. @test

Implementation

@generates

API

export interface LanguageServerConfig {
  /** Unique identifier for the language server */
  id: string;
  /** Language identifiers handled by this server */
  languages: string[];
  /** Command and arguments used to start the server */
  argv: string[];
}

export interface DiagnosticSummary {
  message: string;
  severity: 'error' | 'warning' | 'info';
  /** 1-based line number */
  line: number;
  /** 1-based column number */
  column: number;
}

export interface CompletionItem {
  label: string;
  detail?: string;
}

/**
 * Turns on the JupyterLab LSP service and registers the provided language servers.
 */
export async function activateLspService(configs: LanguageServerConfig[]): Promise<void>;

/**
 * Requests diagnostics for a given document path after the LSP service is active.
 */
export async function requestDiagnostics(documentPath: string): Promise<DiagnosticSummary[]>;

/**
 * Requests completion items for a document and cursor offset using the active language server.
 */
export async function requestCompletions(
  documentPath: string,
  code: string,
  cursorOffset: number
): Promise<CompletionItem[]>;

/**
 * Resolves a definition location for a symbol within the document, if provided by the server.
 */
export async function locateDefinition(documentPath: string, symbol: string): Promise<string | null>;

Dependencies { .dependencies }

JupyterLab { .dependency }

Provides the application shell and extension system needed to host the module. @satisfied-by

jupyterlab-lsp { .dependency }

Provides the Language Server Protocol service and client-side hooks for diagnostics, completions, and navigation. @satisfied-by