opencode-qml-lsp 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.js +15 -19
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -8,18 +8,20 @@ const NOISY_WARNINGS = [
|
|
|
8
8
|
];
|
|
9
9
|
|
|
10
10
|
function filterDiagnostics(diagnostics) {
|
|
11
|
-
|
|
11
|
+
if (!diagnostics) return diagnostics;
|
|
12
|
+
console.log("[qml-lsp] Raw diagnostics:", diagnostics.length);
|
|
13
|
+
const filtered = diagnostics.filter(d => {
|
|
12
14
|
const code = d.code?.toString?.() || "";
|
|
13
|
-
|
|
15
|
+
const message = d.message || "";
|
|
16
|
+
return !NOISY_WARNINGS.some(noisy => code.includes(noisy) || message.includes(noisy));
|
|
14
17
|
});
|
|
18
|
+
console.log("[qml-lsp] Filtered to:", filtered.length);
|
|
19
|
+
return filtered;
|
|
15
20
|
}
|
|
16
21
|
|
|
17
|
-
/**
|
|
18
|
-
* opencode-qml-lsp — QML language server support for OpenCode
|
|
19
|
-
* @type {import('@opencode-ai/plugin').Plugin}
|
|
20
|
-
*/
|
|
21
22
|
export const QmlLspPlugin = async (ctx) => {
|
|
22
23
|
const { project, client, $, directory } = ctx;
|
|
24
|
+
console.log("[qml-lsp] Plugin loaded for:", directory);
|
|
23
25
|
|
|
24
26
|
const setup = QmlLspSetup({ client, $, directory });
|
|
25
27
|
const fixTool = QmlFixTool({ client, $, directory });
|
|
@@ -27,7 +29,7 @@ export const QmlLspPlugin = async (ctx) => {
|
|
|
27
29
|
return {
|
|
28
30
|
tool: {
|
|
29
31
|
qml_setup: tool({
|
|
30
|
-
description: "Run QML project setup: detect qmlls, generate .qmllint.ini and LSP config
|
|
32
|
+
description: "Run QML project setup: detect qmlls, generate .qmllint.ini and LSP config",
|
|
31
33
|
args: {},
|
|
32
34
|
async execute(_args, context) {
|
|
33
35
|
const result = setup.run();
|
|
@@ -38,26 +40,20 @@ export const QmlLspPlugin = async (ctx) => {
|
|
|
38
40
|
`QML setup complete!`,
|
|
39
41
|
``,
|
|
40
42
|
`Found: ${result.qmllsPath}`,
|
|
41
|
-
`PySide6 QML import: ${result.qmlImportPath || "not found
|
|
42
|
-
`.qml files
|
|
43
|
+
`PySide6 QML import: ${result.qmlImportPath || "not found"}`,
|
|
44
|
+
`.qml files: ${result.qmlFileCount}`,
|
|
43
45
|
``,
|
|
44
|
-
`Generated
|
|
45
|
-
result.generatedFiles.map(f => ` - ${f}`).join("\n"),
|
|
46
|
-
``,
|
|
47
|
-
`Note: The qmlls bundled with PySide6 doesn't support .qmllint.ini filtering.`,
|
|
48
|
-
`The plugin filters diagnostics client-side to suppress noisy warnings.`,
|
|
49
|
-
``,
|
|
50
|
-
`Next step: Merge the "lsp" block from opencode-qml-lsp.config.json into your opencode.json`,
|
|
46
|
+
`Generated: ${result.generatedFiles.join(", ")}`,
|
|
51
47
|
].join("\n");
|
|
52
48
|
},
|
|
53
49
|
}),
|
|
54
50
|
qml_fix_warnings: fixTool.tool,
|
|
55
51
|
},
|
|
56
52
|
"lsp.client.diagnostics": async (input, output) => {
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
console.log("[qml-lsp] diagnostics hook:", input.uri, input.diagnostics?.length);
|
|
54
|
+
output.diagnostics = filterDiagnostics(input.diagnostics);
|
|
59
55
|
},
|
|
60
56
|
};
|
|
61
57
|
};
|
|
62
58
|
|
|
63
|
-
export default QmlLspPlugin;
|
|
59
|
+
export default QmlLspPlugin;
|