-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support qmlls
#251
Comments
So let me share my experience with adding a minimal qmlls support to vscode @seanwu1105 . The current state ( Qt 6.6 development branch) is quite bare bone. It does basic autocompletion, but no syntax highlighting. See Qt issue https://bugreports.qt.io/browse/QTBUG-97637 firefox_Ox1nErgg48.mp4Adding support via:
"activationEvents": [
"onLanguage:qml"
],
"contributes": {
"commands": [
{
"command": "testy.helloWorld",
"title": "Hello World"
}
],
"languages": [
{
"id": "qml",
"extensions": [".qml"],
"aliases": [ "qml"],
"filenames": [],
"firstLine": "^#!/.*\\bpython[0-9.-]*\\b",
"configuration": "./language-configuration.json",
"icon": {
"light": "./icons/qml-light.png",
"dark": "./icons/qmldark.png"
}
}
]
}, Then start the language server in the // The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import { workspace, ExtensionContext } from 'vscode';
import * as vscode from 'vscode';
import {
LanguageClient,
LanguageClientOptions,
ServerOptions,
Executable,
ExecutableOptions
} from 'vscode-languageclient/node';
let client: LanguageClient;
// 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) {
// If the extension is launched in debug mode then the debug server options are used
// Otherwise the run options are used
const execOpt: ExecutableOptions = { cwd: 'C:/build_qt_debug/qtbase/bin/', env:"QT_LOGGING_RULES='qt.languageserver.*=true'"};
const execArgs: string[] = ["-l", "C:/Users/Eli/Desktop/test.txt"];
const exec: Executable = { command: "C:/build_qt_debug/qtbase/bin/qmlls.exe", args: execArgs, options: execOpt };
const serverOptions: ServerOptions = {
run: exec,
debug: exec
};
// Options to control the language client
const clientOptions: LanguageClientOptions = {
// Register the server for plain text documents
documentSelector: [{ scheme: 'file', language: 'qml'}]
};
// Create the language client and start the client.
client = new LanguageClient(
'qml',
'QML Language Server',
serverOptions,
clientOptions,
true
);
// Start the client. This will also launch the server
client.start();
}
// This method is called when your extension is deactivated
export function deactivate() {} |
Hi @kelteseth, thanks for sharing. I know the way to build a language server as I use it to build the linter in the current extension. I don't have time to add this feature for now. It would be great if you can create a PR adding qmlls support to the extension. |
qmlls
extensionPath
withextensionUri
qmllint
asqmlls
includes the linting featureqmlls
pathqmlls
CLI optionsqmlls
qmlls
is working with default configurationsqmlls
scopeThe text was updated successfully, but these errors were encountered: