VS Команды расширения кода не работаютJavascript

Форум по Javascript
Ответить
Anonymous
 VS Команды расширения кода не работают

Сообщение Anonymous »

Я разрабатываю простое расширение кода, и оно не работает из коробки. Я создал абсолютно чистый TypeScript Ext (просто используя yo code в терминале), также протестированный в JS, и он тоже не работает, он не работает как на Linux, так и на Windows. Из коробки это не видит предварительную команду Hello World. Я делаю что-то неверное или это проблема с кодом VS, но я только что создал Clean Ext, нажал F5, нажатый Ctrl+Shift+P, и это не видит Hello World.
Это Package.json
{
"name": "ext-test",
"displayName": "ext_test",
"description": "daffghfdhnf",
"version": "0.0.1",
"engines": {
"vscode": "^1.101.0"
},
"categories": [
"Other"
],
"activationEvents": [],
"main": "./out/extension.js",
"contributes": {
"commands": [
{
"command": "ext-test.helloWorld",
"title": "Hello World"
}
]
},
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"pretest": "npm run compile && npm run lint",
"lint": "eslint src",
"test": "vscode-test"
},
"devDependencies": {
"@types/vscode": "^1.101.0",
"@types/mocha": "^10.0.10",
"@types/node": "20.x",
"@typescript-eslint/eslint-plugin": "^8.31.1",
"@typescript-eslint/parser": "^8.31.1",
"eslint": "^9.25.1",
"typescript": "^5.8.3",
"@vscode/test-cli": "^0.0.10",
"@vscode/test-electron": "^2.5.2"
}
}

Это extension.ts
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import * as vscode from 'vscode';

// This method is called when your extension is activated
// Your extension is activated the very first time the command is executed
export function activate(context: vscode.ExtensionContext) {

// Use the console to output diagnostic information (console.log) and errors (console.error)
// This line of code will only be executed once when your extension is activated
console.log('Congratulations, your extension "ext-test" is now active!');

// The command has been defined in the package.json file
// Now provide the implementation of the command with registerCommand
// The commandId parameter must match the command field in package.json
const disposable = vscode.commands.registerCommand('ext-test.helloWorld', () => {
// The code you place here will be executed every time your command is executed
// Display a message box to the user
vscode.window.showInformationMessage('Hello World from ext_test!');
});

context.subscriptions.push(disposable);
}

// This method is called when your extension is deactivated
export function deactivate() {}


Подробнее здесь: https://stackoverflow.com/questions/796 ... nt-working
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Javascript»