From 4c4a3487d665d1f92b0986f35f2ceedea2c7bb90 Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Tue, 9 Sep 2025 15:05:32 -0500 Subject: [PATCH 1/2] rudimentary logging --- client/src/extension.ts | 13 +++++++++++++ package.json | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/client/src/extension.ts b/client/src/extension.ts index 728e7b5..7934c14 100644 --- a/client/src/extension.ts +++ b/client/src/extension.ts @@ -6,6 +6,7 @@ import * as vscode from 'vscode'; import * as which from 'which'; +import { window, type OutputChannel } from 'vscode'; import { LanguageClient, @@ -15,6 +16,7 @@ import { import { time } from 'console'; let client: LanguageClient; +let outputChannel: OutputChannel; function findNushellExecutable(): string | null { try { @@ -48,6 +50,8 @@ function startLanguageServer( context: vscode.ExtensionContext, found_nushell_path: string, ): void { + outputChannel = window.createOutputChannel('Nushell LSP Output', 'log'); + // Use Nushell's native LSP server const serverOptions: ServerOptions = { run: { @@ -62,6 +66,11 @@ function startLanguageServer( // Options to control the language client const clientOptions: LanguageClientOptions = { + outputChannelName: 'Nushell Language Server', + markdown: { + isTrusted: true, + supportHtml: true, + }, initializationOptions: { timeout: 10000, // 10 seconds }, @@ -168,6 +177,10 @@ export function activate(context: vscode.ExtensionContext) { return; } + context.subscriptions.push(outputChannel); + console.log(`Found nushell executable at: ${found_nushell_path}`); + console.log('Activating Nushell Language Server extension.'); + // Start the language server when the extension is activated startLanguageServer(context, found_nushell_path); diff --git a/package.json b/package.json index da59a55..c1c0fbf 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "vscode-nushell-lang", "description": "nushell language for vscode", "author": "The Nushell Project Developers", - "version": "2.0.1", + "version": "2.0.2", "preview": false, "license": "MIT", "publisher": "TheNuProjectContributors", From 0cdf53716afd72cdf886e1d6f1a1b32cc7d8a284 Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Wed, 10 Sep 2025 08:31:59 -0500 Subject: [PATCH 2/2] add eslint config, fix some lints --- client/src/extension.ts | 5 +++-- eslint.config.js | 17 +++++++++++++++++ package-lock.json | 6 +++--- package.json | 6 +++--- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/client/src/extension.ts b/client/src/extension.ts index df67c33..a8e4e8a 100644 --- a/client/src/extension.ts +++ b/client/src/extension.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-var-requires */ /* -------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. @@ -42,7 +41,7 @@ function findNushellExecutable(): string | null { // Fall back to searching PATH for 'nu' return which.sync('nu', { nothrow: true }); - } catch (error) { + } catch { return null; } } @@ -184,6 +183,8 @@ export function activate(context: vscode.ExtensionContext) { provideTerminalProfile( token: vscode.CancellationToken, ): vscode.ProviderResult { + // Consume token to satisfy no-unused-vars without changing behavior + void token; if (found_nushell_path == null) { console.log( 'Nushell not found in env:PATH or any of the heuristic locations.', diff --git a/eslint.config.js b/eslint.config.js index e69de29..4f3a06e 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -0,0 +1,17 @@ +module.exports = [ + { + files: ['**/*.ts'], // Apply to all TypeScript files + languageOptions: { + parser: require('@typescript-eslint/parser'), // Use TypeScript parser + sourceType: 'module', + }, + plugins: { + '@typescript-eslint': require('@typescript-eslint/eslint-plugin'), + }, + rules: { + // Add your preferred rules here, or start with recommended + '@typescript-eslint/no-unused-vars': 'warn', + // Add more rules as needed + }, + }, +]; diff --git a/package-lock.json b/package-lock.json index 098705d..c16e385 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,11 +19,11 @@ "@types/node": "24.3.0", "@types/tmp": "0.2.6", "@types/vscode": "^1.93.0", - "@typescript-eslint/eslint-plugin": "8.42.0", - "@typescript-eslint/parser": "8.42.0", + "@typescript-eslint/eslint-plugin": "^8.42.0", + "@typescript-eslint/parser": "^8.42.0", "@vscode/vsce": "3.6.0", "esbuild": "0.25.9", - "eslint": "9.34.0", + "eslint": "^9.34.0", "mocha": "11.7.2", "prettier": "3.6.2", "ts-loader": "9.5.4", diff --git a/package.json b/package.json index 6f1fcde..76bb311 100644 --- a/package.json +++ b/package.json @@ -173,11 +173,11 @@ "@types/node": "24.3.0", "@types/tmp": "0.2.6", "@types/vscode": "^1.93.0", - "@typescript-eslint/eslint-plugin": "8.42.0", - "@typescript-eslint/parser": "8.42.0", + "@typescript-eslint/eslint-plugin": "^8.42.0", + "@typescript-eslint/parser": "^8.42.0", "@vscode/vsce": "3.6.0", "esbuild": "0.25.9", - "eslint": "9.34.0", + "eslint": "^9.34.0", "mocha": "11.7.2", "prettier": "3.6.2", "ts-loader": "9.5.4",