@fresh-editor/fresh-editor 0.2.16 → 0.2.18
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/CHANGELOG.md +91 -0
- package/package.json +1 -1
- package/plugins/astro-lsp.ts +118 -0
- package/plugins/bash-lsp.ts +161 -0
- package/plugins/clojure-lsp.ts +125 -0
- package/plugins/cmake-lsp.ts +138 -0
- package/plugins/config-schema.json +33 -4
- package/plugins/dart-lsp.ts +144 -0
- package/plugins/elixir-lsp.ts +120 -0
- package/plugins/erlang-lsp.ts +121 -0
- package/plugins/fsharp-lsp.ts +125 -0
- package/plugins/gleam-lsp.ts +124 -0
- package/plugins/graphql-lsp.ts +139 -0
- package/plugins/haskell-lsp.ts +125 -0
- package/plugins/julia-lsp.ts +111 -0
- package/plugins/kotlin-lsp.ts +162 -0
- package/plugins/lib/fresh.d.ts +25 -0
- package/plugins/lua-lsp.ts +161 -0
- package/plugins/nim-lsp.ts +118 -0
- package/plugins/nix-lsp.ts +125 -0
- package/plugins/nushell-lsp.ts +144 -0
- package/plugins/ocaml-lsp.ts +119 -0
- package/plugins/perl-lsp.ts +118 -0
- package/plugins/php-lsp.ts +165 -0
- package/plugins/pkg.ts +33 -47
- package/plugins/protobuf-lsp.ts +144 -0
- package/plugins/r-lsp.ts +118 -0
- package/plugins/ruby-lsp.ts +165 -0
- package/plugins/scala-lsp.ts +119 -0
- package/plugins/solidity-lsp.ts +130 -0
- package/plugins/sql-lsp.ts +129 -0
- package/plugins/svelte-lsp.ts +119 -0
- package/plugins/swift-lsp.ts +120 -0
- package/plugins/tailwindcss-lsp.ts +119 -0
- package/plugins/terraform-lsp.ts +144 -0
- package/plugins/theme_editor.i18n.json +70 -14
- package/plugins/theme_editor.ts +71 -39
- package/plugins/toml-lsp.ts +162 -0
- package/plugins/typst-lsp.ts +165 -0
- package/plugins/vue-lsp.ts +118 -0
- package/plugins/yaml-lsp.ts +163 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/// <reference path="./lib/fresh.d.ts" />
|
|
2
|
+
const editor = getEditor();
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Svelte LSP Helper Plugin
|
|
6
|
+
*
|
|
7
|
+
* Server: svelte-language-server (binary: svelteserver)
|
|
8
|
+
* VS Code: "Svelte for VS Code" extension
|
|
9
|
+
* Neovim: nvim-lspconfig svelte
|
|
10
|
+
* Note: Also install typescript-svelte-plugin for TS integration
|
|
11
|
+
* CLI tool: svelte-check for CI diagnostics
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
interface LspServerErrorData {
|
|
15
|
+
language: string;
|
|
16
|
+
server_command: string;
|
|
17
|
+
error_type: string;
|
|
18
|
+
message: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface LspStatusClickedData {
|
|
22
|
+
language: string;
|
|
23
|
+
has_error: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface ActionPopupResultData {
|
|
27
|
+
popup_id: string;
|
|
28
|
+
action_id: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const INSTALL_COMMANDS = {
|
|
32
|
+
npm: "npm install -g svelte-language-server",
|
|
33
|
+
yarn: "yarn global add svelte-language-server",
|
|
34
|
+
pnpm: "pnpm add -g svelte-language-server",
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
let svelteLspError: { serverCommand: string; message: string } | null = null;
|
|
38
|
+
|
|
39
|
+
function on_svelte_lsp_server_error(data: LspServerErrorData): void {
|
|
40
|
+
if (data.language !== "svelte") {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
editor.debug(`svelte-lsp: Server error - ${data.error_type}: ${data.message}`);
|
|
45
|
+
|
|
46
|
+
svelteLspError = {
|
|
47
|
+
serverCommand: data.server_command,
|
|
48
|
+
message: data.message,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
if (data.error_type === "not_found") {
|
|
52
|
+
editor.setStatus(
|
|
53
|
+
`Svelte LSP server '${data.server_command}' not found. Click status bar for help.`
|
|
54
|
+
);
|
|
55
|
+
} else {
|
|
56
|
+
editor.setStatus(`Svelte LSP error: ${data.message}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
registerHandler("on_svelte_lsp_server_error", on_svelte_lsp_server_error);
|
|
60
|
+
editor.on("lsp_server_error", "on_svelte_lsp_server_error");
|
|
61
|
+
|
|
62
|
+
function on_svelte_lsp_status_clicked(data: LspStatusClickedData): void {
|
|
63
|
+
if (data.language !== "svelte" || !svelteLspError) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
editor.debug("svelte-lsp: Status clicked, showing help popup");
|
|
68
|
+
|
|
69
|
+
editor.showActionPopup({
|
|
70
|
+
id: "svelte-lsp-help",
|
|
71
|
+
title: "Svelte Language Server Not Found",
|
|
72
|
+
message: `"${svelteLspError.serverCommand}" provides completion, diagnostics, and formatting for Svelte components.\n\nFor TypeScript integration, also install typescript-svelte-plugin in your project.\nUse svelte-check for CI diagnostics.\nVS Code users: Install the "Svelte for VS Code" extension.\nSee: https://github.com/sveltejs/language-tools`,
|
|
73
|
+
actions: [
|
|
74
|
+
{ id: "copy_npm", label: `Copy: ${INSTALL_COMMANDS.npm}` },
|
|
75
|
+
{ id: "copy_pnpm", label: `Copy: ${INSTALL_COMMANDS.pnpm}` },
|
|
76
|
+
{ id: "disable", label: "Disable Svelte LSP" },
|
|
77
|
+
{ id: "dismiss", label: "Dismiss (ESC)" },
|
|
78
|
+
],
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
registerHandler("on_svelte_lsp_status_clicked", on_svelte_lsp_status_clicked);
|
|
82
|
+
editor.on("lsp_status_clicked", "on_svelte_lsp_status_clicked");
|
|
83
|
+
|
|
84
|
+
function on_svelte_lsp_action_result(data: ActionPopupResultData): void {
|
|
85
|
+
if (data.popup_id !== "svelte-lsp-help") {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
editor.debug(`svelte-lsp: Action selected - ${data.action_id}`);
|
|
90
|
+
|
|
91
|
+
switch (data.action_id) {
|
|
92
|
+
case "copy_npm":
|
|
93
|
+
editor.setClipboard(INSTALL_COMMANDS.npm);
|
|
94
|
+
editor.setStatus("Copied: " + INSTALL_COMMANDS.npm);
|
|
95
|
+
break;
|
|
96
|
+
|
|
97
|
+
case "copy_pnpm":
|
|
98
|
+
editor.setClipboard(INSTALL_COMMANDS.pnpm);
|
|
99
|
+
editor.setStatus("Copied: " + INSTALL_COMMANDS.pnpm);
|
|
100
|
+
break;
|
|
101
|
+
|
|
102
|
+
case "disable":
|
|
103
|
+
editor.disableLspForLanguage("svelte");
|
|
104
|
+
editor.setStatus("Svelte LSP disabled");
|
|
105
|
+
svelteLspError = null;
|
|
106
|
+
break;
|
|
107
|
+
|
|
108
|
+
case "dismiss":
|
|
109
|
+
case "dismissed":
|
|
110
|
+
break;
|
|
111
|
+
|
|
112
|
+
default:
|
|
113
|
+
editor.debug(`svelte-lsp: Unknown action: ${data.action_id}`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
registerHandler("on_svelte_lsp_action_result", on_svelte_lsp_action_result);
|
|
117
|
+
editor.on("action_popup_result", "on_svelte_lsp_action_result");
|
|
118
|
+
|
|
119
|
+
editor.debug("svelte-lsp: Plugin loaded");
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/// <reference path="./lib/fresh.d.ts" />
|
|
2
|
+
const editor = getEditor();
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Swift LSP Helper Plugin
|
|
6
|
+
*
|
|
7
|
+
* Server: sourcekit-lsp (bundled with Xcode/Swift toolchain)
|
|
8
|
+
* VS Code: "Swift" extension by Swift Server Work Group
|
|
9
|
+
* Neovim: nvim-lspconfig sourcekit
|
|
10
|
+
* macOS: Included with Xcode (xcrun sourcekit-lsp)
|
|
11
|
+
* Linux: Install Swift toolchain from swift.org
|
|
12
|
+
* Note: For Xcode projects, also install xcode-build-server
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
interface LspServerErrorData {
|
|
16
|
+
language: string;
|
|
17
|
+
server_command: string;
|
|
18
|
+
error_type: string;
|
|
19
|
+
message: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface LspStatusClickedData {
|
|
23
|
+
language: string;
|
|
24
|
+
has_error: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface ActionPopupResultData {
|
|
28
|
+
popup_id: string;
|
|
29
|
+
action_id: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const INSTALL_COMMANDS = {
|
|
33
|
+
macos: "xcode-select --install",
|
|
34
|
+
linux: "# Download Swift from https://swift.org/download/",
|
|
35
|
+
xcode_build_server: "brew install xcode-build-server",
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
let swiftLspError: { serverCommand: string; message: string } | null = null;
|
|
39
|
+
|
|
40
|
+
function on_swift_lsp_server_error(data: LspServerErrorData): void {
|
|
41
|
+
if (data.language !== "swift") {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
editor.debug(`swift-lsp: Server error - ${data.error_type}: ${data.message}`);
|
|
46
|
+
|
|
47
|
+
swiftLspError = {
|
|
48
|
+
serverCommand: data.server_command,
|
|
49
|
+
message: data.message,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
if (data.error_type === "not_found") {
|
|
53
|
+
editor.setStatus(
|
|
54
|
+
`Swift LSP server '${data.server_command}' not found. Click status bar for help.`
|
|
55
|
+
);
|
|
56
|
+
} else {
|
|
57
|
+
editor.setStatus(`Swift LSP error: ${data.message}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
registerHandler("on_swift_lsp_server_error", on_swift_lsp_server_error);
|
|
61
|
+
editor.on("lsp_server_error", "on_swift_lsp_server_error");
|
|
62
|
+
|
|
63
|
+
function on_swift_lsp_status_clicked(data: LspStatusClickedData): void {
|
|
64
|
+
if (data.language !== "swift" || !swiftLspError) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
editor.debug("swift-lsp: Status clicked, showing help popup");
|
|
69
|
+
|
|
70
|
+
editor.showActionPopup({
|
|
71
|
+
id: "swift-lsp-help",
|
|
72
|
+
title: "Swift Language Server Not Found",
|
|
73
|
+
message: `"${swiftLspError.serverCommand}" provides completion, diagnostics, and navigation for Swift files. It is bundled with the Swift toolchain.\n\nmacOS: Install Xcode Command Line Tools. Use 'xcrun sourcekit-lsp' if not in PATH.\nLinux: Download the Swift toolchain from swift.org.\nFor Xcode projects: Install xcode-build-server for build system integration.\nVS Code users: Install the "Swift" extension.\nSee: https://github.com/swiftlang/sourcekit-lsp`,
|
|
74
|
+
actions: [
|
|
75
|
+
{ id: "copy_macos", label: `Copy: ${INSTALL_COMMANDS.macos}` },
|
|
76
|
+
{ id: "copy_xbs", label: `Copy: ${INSTALL_COMMANDS.xcode_build_server}` },
|
|
77
|
+
{ id: "disable", label: "Disable Swift LSP" },
|
|
78
|
+
{ id: "dismiss", label: "Dismiss (ESC)" },
|
|
79
|
+
],
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
registerHandler("on_swift_lsp_status_clicked", on_swift_lsp_status_clicked);
|
|
83
|
+
editor.on("lsp_status_clicked", "on_swift_lsp_status_clicked");
|
|
84
|
+
|
|
85
|
+
function on_swift_lsp_action_result(data: ActionPopupResultData): void {
|
|
86
|
+
if (data.popup_id !== "swift-lsp-help") {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
editor.debug(`swift-lsp: Action selected - ${data.action_id}`);
|
|
91
|
+
|
|
92
|
+
switch (data.action_id) {
|
|
93
|
+
case "copy_macos":
|
|
94
|
+
editor.setClipboard(INSTALL_COMMANDS.macos);
|
|
95
|
+
editor.setStatus("Copied: " + INSTALL_COMMANDS.macos);
|
|
96
|
+
break;
|
|
97
|
+
|
|
98
|
+
case "copy_xbs":
|
|
99
|
+
editor.setClipboard(INSTALL_COMMANDS.xcode_build_server);
|
|
100
|
+
editor.setStatus("Copied: " + INSTALL_COMMANDS.xcode_build_server);
|
|
101
|
+
break;
|
|
102
|
+
|
|
103
|
+
case "disable":
|
|
104
|
+
editor.disableLspForLanguage("swift");
|
|
105
|
+
editor.setStatus("Swift LSP disabled");
|
|
106
|
+
swiftLspError = null;
|
|
107
|
+
break;
|
|
108
|
+
|
|
109
|
+
case "dismiss":
|
|
110
|
+
case "dismissed":
|
|
111
|
+
break;
|
|
112
|
+
|
|
113
|
+
default:
|
|
114
|
+
editor.debug(`swift-lsp: Unknown action: ${data.action_id}`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
registerHandler("on_swift_lsp_action_result", on_swift_lsp_action_result);
|
|
118
|
+
editor.on("action_popup_result", "on_swift_lsp_action_result");
|
|
119
|
+
|
|
120
|
+
editor.debug("swift-lsp: Plugin loaded");
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/// <reference path="./lib/fresh.d.ts" />
|
|
2
|
+
const editor = getEditor();
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Tailwind CSS LSP Helper Plugin
|
|
6
|
+
*
|
|
7
|
+
* Server: @tailwindcss/language-server (binary: tailwindcss-language-server)
|
|
8
|
+
* VS Code: "Tailwind CSS IntelliSense" official extension
|
|
9
|
+
* Neovim: nvim-lspconfig tailwindcss
|
|
10
|
+
* Note: Needs Tailwind CSS in your project (tailwind.config.js or CSS @import)
|
|
11
|
+
* Features: class completion, color preview, hover info, linting
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
interface LspServerErrorData {
|
|
15
|
+
language: string;
|
|
16
|
+
server_command: string;
|
|
17
|
+
error_type: string;
|
|
18
|
+
message: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface LspStatusClickedData {
|
|
22
|
+
language: string;
|
|
23
|
+
has_error: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface ActionPopupResultData {
|
|
27
|
+
popup_id: string;
|
|
28
|
+
action_id: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const INSTALL_COMMANDS = {
|
|
32
|
+
npm: "npm install -g @tailwindcss/language-server",
|
|
33
|
+
yarn: "yarn global add @tailwindcss/language-server",
|
|
34
|
+
pnpm: "pnpm add -g @tailwindcss/language-server",
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
let tailwindLspError: { serverCommand: string; message: string } | null = null;
|
|
38
|
+
|
|
39
|
+
function on_tailwindcss_lsp_server_error(data: LspServerErrorData): void {
|
|
40
|
+
if (data.language !== "tailwindcss") {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
editor.debug(`tailwindcss-lsp: Server error - ${data.error_type}: ${data.message}`);
|
|
45
|
+
|
|
46
|
+
tailwindLspError = {
|
|
47
|
+
serverCommand: data.server_command,
|
|
48
|
+
message: data.message,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
if (data.error_type === "not_found") {
|
|
52
|
+
editor.setStatus(
|
|
53
|
+
`Tailwind CSS LSP server '${data.server_command}' not found. Click status bar for help.`
|
|
54
|
+
);
|
|
55
|
+
} else {
|
|
56
|
+
editor.setStatus(`Tailwind CSS LSP error: ${data.message}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
registerHandler("on_tailwindcss_lsp_server_error", on_tailwindcss_lsp_server_error);
|
|
60
|
+
editor.on("lsp_server_error", "on_tailwindcss_lsp_server_error");
|
|
61
|
+
|
|
62
|
+
function on_tailwindcss_lsp_status_clicked(data: LspStatusClickedData): void {
|
|
63
|
+
if (data.language !== "tailwindcss" || !tailwindLspError) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
editor.debug("tailwindcss-lsp: Status clicked, showing help popup");
|
|
68
|
+
|
|
69
|
+
editor.showActionPopup({
|
|
70
|
+
id: "tailwindcss-lsp-help",
|
|
71
|
+
title: "Tailwind CSS Language Server Not Found",
|
|
72
|
+
message: `"${tailwindLspError.serverCommand}" provides class name completion, color previews, hover info, and linting for Tailwind CSS.\n\nRequires Tailwind CSS configured in your project (tailwind.config.js or v4 CSS @import).\nVS Code users: Install "Tailwind CSS IntelliSense" extension.\nSee: https://github.com/tailwindlabs/tailwindcss-intellisense`,
|
|
73
|
+
actions: [
|
|
74
|
+
{ id: "copy_npm", label: `Copy: ${INSTALL_COMMANDS.npm}` },
|
|
75
|
+
{ id: "copy_pnpm", label: `Copy: ${INSTALL_COMMANDS.pnpm}` },
|
|
76
|
+
{ id: "disable", label: "Disable Tailwind CSS LSP" },
|
|
77
|
+
{ id: "dismiss", label: "Dismiss (ESC)" },
|
|
78
|
+
],
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
registerHandler("on_tailwindcss_lsp_status_clicked", on_tailwindcss_lsp_status_clicked);
|
|
82
|
+
editor.on("lsp_status_clicked", "on_tailwindcss_lsp_status_clicked");
|
|
83
|
+
|
|
84
|
+
function on_tailwindcss_lsp_action_result(data: ActionPopupResultData): void {
|
|
85
|
+
if (data.popup_id !== "tailwindcss-lsp-help") {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
editor.debug(`tailwindcss-lsp: Action selected - ${data.action_id}`);
|
|
90
|
+
|
|
91
|
+
switch (data.action_id) {
|
|
92
|
+
case "copy_npm":
|
|
93
|
+
editor.setClipboard(INSTALL_COMMANDS.npm);
|
|
94
|
+
editor.setStatus("Copied: " + INSTALL_COMMANDS.npm);
|
|
95
|
+
break;
|
|
96
|
+
|
|
97
|
+
case "copy_pnpm":
|
|
98
|
+
editor.setClipboard(INSTALL_COMMANDS.pnpm);
|
|
99
|
+
editor.setStatus("Copied: " + INSTALL_COMMANDS.pnpm);
|
|
100
|
+
break;
|
|
101
|
+
|
|
102
|
+
case "disable":
|
|
103
|
+
editor.disableLspForLanguage("tailwindcss");
|
|
104
|
+
editor.setStatus("Tailwind CSS LSP disabled");
|
|
105
|
+
tailwindLspError = null;
|
|
106
|
+
break;
|
|
107
|
+
|
|
108
|
+
case "dismiss":
|
|
109
|
+
case "dismissed":
|
|
110
|
+
break;
|
|
111
|
+
|
|
112
|
+
default:
|
|
113
|
+
editor.debug(`tailwindcss-lsp: Unknown action: ${data.action_id}`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
registerHandler("on_tailwindcss_lsp_action_result", on_tailwindcss_lsp_action_result);
|
|
117
|
+
editor.on("action_popup_result", "on_tailwindcss_lsp_action_result");
|
|
118
|
+
|
|
119
|
+
editor.debug("tailwindcss-lsp: Plugin loaded");
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/// <reference path="./lib/fresh.d.ts" />
|
|
2
|
+
const editor = getEditor();
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Terraform LSP Helper Plugin
|
|
6
|
+
*
|
|
7
|
+
* Provides user-friendly error handling for Terraform LSP server issues.
|
|
8
|
+
* When terraform-ls fails to start, this plugin shows an actionable
|
|
9
|
+
* popup with installation instructions.
|
|
10
|
+
*
|
|
11
|
+
* Features:
|
|
12
|
+
* - Detects Terraform LSP server errors (terraform-ls)
|
|
13
|
+
* - Shows popup with install commands (brew, choco, etc.)
|
|
14
|
+
* - Provides option to disable Terraform LSP
|
|
15
|
+
*
|
|
16
|
+
* VS Code: "HashiCorp Terraform" extension (uses terraform-ls)
|
|
17
|
+
* Neovim: nvim-lspconfig terraformls
|
|
18
|
+
* Also supports: Terraform, Terraform variables, and tfvars files
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
interface LspServerErrorData {
|
|
22
|
+
language: string;
|
|
23
|
+
server_command: string;
|
|
24
|
+
error_type: string;
|
|
25
|
+
message: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface LspStatusClickedData {
|
|
29
|
+
language: string;
|
|
30
|
+
has_error: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface ActionPopupResultData {
|
|
34
|
+
popup_id: string;
|
|
35
|
+
action_id: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Install commands for Terraform LSP server (terraform-ls by HashiCorp)
|
|
39
|
+
// See: https://github.com/hashicorp/terraform-ls
|
|
40
|
+
const INSTALL_COMMANDS = {
|
|
41
|
+
brew: "brew install hashicorp/tap/terraform-ls",
|
|
42
|
+
choco: "choco install terraform-ls",
|
|
43
|
+
nix: "nix-env -i terraform-ls",
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// Track error state for Terraform LSP
|
|
47
|
+
let terraformLspError: { serverCommand: string; message: string } | null = null;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Handle LSP server errors for Terraform
|
|
51
|
+
*/
|
|
52
|
+
function on_terraform_lsp_server_error(data: LspServerErrorData): void {
|
|
53
|
+
if (data.language !== "terraform") {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
editor.debug(`terraform-lsp: Server error - ${data.error_type}: ${data.message}`);
|
|
58
|
+
|
|
59
|
+
terraformLspError = {
|
|
60
|
+
serverCommand: data.server_command,
|
|
61
|
+
message: data.message,
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
if (data.error_type === "not_found") {
|
|
65
|
+
editor.setStatus(
|
|
66
|
+
`Terraform LSP server '${data.server_command}' not found. Click status bar for help.`
|
|
67
|
+
);
|
|
68
|
+
} else {
|
|
69
|
+
editor.setStatus(`Terraform LSP error: ${data.message}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
registerHandler("on_terraform_lsp_server_error", on_terraform_lsp_server_error);
|
|
73
|
+
editor.on("lsp_server_error", "on_terraform_lsp_server_error");
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Handle status bar click when there's a Terraform LSP error
|
|
77
|
+
*/
|
|
78
|
+
function on_terraform_lsp_status_clicked(data: LspStatusClickedData): void {
|
|
79
|
+
if (data.language !== "terraform" || !terraformLspError) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
editor.debug("terraform-lsp: Status clicked, showing help popup");
|
|
84
|
+
|
|
85
|
+
editor.showActionPopup({
|
|
86
|
+
id: "terraform-lsp-help",
|
|
87
|
+
title: "Terraform Language Server Not Found",
|
|
88
|
+
message: `"${terraformLspError.serverCommand}" (by HashiCorp) provides code completion, diagnostics, and navigation for Terraform files. Copy a command below to install it, or visit https://github.com/hashicorp/terraform-ls for details and pre-built binaries.`,
|
|
89
|
+
actions: [
|
|
90
|
+
{ id: "copy_brew", label: `Copy: ${INSTALL_COMMANDS.brew}` },
|
|
91
|
+
{ id: "copy_choco", label: `Copy: ${INSTALL_COMMANDS.choco} (Windows)` },
|
|
92
|
+
{ id: "copy_nix", label: `Copy: ${INSTALL_COMMANDS.nix}` },
|
|
93
|
+
{ id: "disable", label: "Disable Terraform LSP" },
|
|
94
|
+
{ id: "dismiss", label: "Dismiss (ESC)" },
|
|
95
|
+
],
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
registerHandler("on_terraform_lsp_status_clicked", on_terraform_lsp_status_clicked);
|
|
99
|
+
editor.on("lsp_status_clicked", "on_terraform_lsp_status_clicked");
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Handle action popup results for Terraform LSP help
|
|
103
|
+
*/
|
|
104
|
+
function on_terraform_lsp_action_result(data: ActionPopupResultData): void {
|
|
105
|
+
if (data.popup_id !== "terraform-lsp-help") {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
editor.debug(`terraform-lsp: Action selected - ${data.action_id}`);
|
|
110
|
+
|
|
111
|
+
switch (data.action_id) {
|
|
112
|
+
case "copy_brew":
|
|
113
|
+
editor.setClipboard(INSTALL_COMMANDS.brew);
|
|
114
|
+
editor.setStatus("Copied: " + INSTALL_COMMANDS.brew);
|
|
115
|
+
break;
|
|
116
|
+
|
|
117
|
+
case "copy_choco":
|
|
118
|
+
editor.setClipboard(INSTALL_COMMANDS.choco);
|
|
119
|
+
editor.setStatus("Copied: " + INSTALL_COMMANDS.choco);
|
|
120
|
+
break;
|
|
121
|
+
|
|
122
|
+
case "copy_nix":
|
|
123
|
+
editor.setClipboard(INSTALL_COMMANDS.nix);
|
|
124
|
+
editor.setStatus("Copied: " + INSTALL_COMMANDS.nix);
|
|
125
|
+
break;
|
|
126
|
+
|
|
127
|
+
case "disable":
|
|
128
|
+
editor.disableLspForLanguage("terraform");
|
|
129
|
+
editor.setStatus("Terraform LSP disabled");
|
|
130
|
+
terraformLspError = null;
|
|
131
|
+
break;
|
|
132
|
+
|
|
133
|
+
case "dismiss":
|
|
134
|
+
case "dismissed":
|
|
135
|
+
break;
|
|
136
|
+
|
|
137
|
+
default:
|
|
138
|
+
editor.debug(`terraform-lsp: Unknown action: ${data.action_id}`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
registerHandler("on_terraform_lsp_action_result", on_terraform_lsp_action_result);
|
|
142
|
+
editor.on("action_popup_result", "on_terraform_lsp_action_result");
|
|
143
|
+
|
|
144
|
+
editor.debug("terraform-lsp: Plugin loaded");
|
|
@@ -296,7 +296,11 @@
|
|
|
296
296
|
"field.popup_selection_fg": "vyskakovací okno výběr popředí",
|
|
297
297
|
"field.popup_selection_fg_desc": "vyskakovací okno selected item text barva",
|
|
298
298
|
"field.whitespace_indicator_fg": "Bílé znaky Indikátor popředí",
|
|
299
|
-
"field.whitespace_indicator_fg_desc": "Barva popředí indikátorů bílých znaků (šipky tabulátorů a tečky mezer)"
|
|
299
|
+
"field.whitespace_indicator_fg_desc": "Barva popředí indikátorů bílých znaků (šipky tabulátorů a tečky mezer)",
|
|
300
|
+
"field.punctuation_bracket": "závorka",
|
|
301
|
+
"field.punctuation_bracket_desc": "závorkas ({, }, (, ), [, ])",
|
|
302
|
+
"field.punctuation_delimiter": "oddělovač",
|
|
303
|
+
"field.punctuation_delimiter_desc": "oddělovačs (;, ,, .)"
|
|
300
304
|
},
|
|
301
305
|
"de": {
|
|
302
306
|
"cmd.edit_theme": "Theme bearbeiten",
|
|
@@ -595,7 +599,11 @@
|
|
|
595
599
|
"field.popup_selection_fg": "Popup Auswahl Vordergrund",
|
|
596
600
|
"field.popup_selection_fg_desc": "Textfarbe des ausgewaehlten Popup-Elements",
|
|
597
601
|
"field.whitespace_indicator_fg": "Leerzeichen-Indikator Vordergrund",
|
|
598
|
-
"field.whitespace_indicator_fg_desc": "Vordergrundfarbe für Leerzeichen-Indikatoren (Tab-Pfeile und Leerzeichen-Punkte)"
|
|
602
|
+
"field.whitespace_indicator_fg_desc": "Vordergrundfarbe für Leerzeichen-Indikatoren (Tab-Pfeile und Leerzeichen-Punkte)",
|
|
603
|
+
"field.punctuation_bracket": "Klammer",
|
|
604
|
+
"field.punctuation_bracket_desc": "Klammern ({, }, (, ), [, ])",
|
|
605
|
+
"field.punctuation_delimiter": "Trennzeichen",
|
|
606
|
+
"field.punctuation_delimiter_desc": "Trennzeichen (;, ,, .)"
|
|
599
607
|
},
|
|
600
608
|
"en": {
|
|
601
609
|
"cmd.edit_theme": "Edit Theme",
|
|
@@ -894,7 +902,11 @@
|
|
|
894
902
|
"field.popup_selection_fg": "Popup Selection Foreground",
|
|
895
903
|
"field.popup_selection_fg_desc": "Popup selected item text color",
|
|
896
904
|
"field.whitespace_indicator_fg": "Whitespace Indicator Foreground",
|
|
897
|
-
"field.whitespace_indicator_fg_desc": "Foreground color for whitespace indicators (tab arrows and space dots)"
|
|
905
|
+
"field.whitespace_indicator_fg_desc": "Foreground color for whitespace indicators (tab arrows and space dots)",
|
|
906
|
+
"field.punctuation_bracket": "Punctuation Bracket",
|
|
907
|
+
"field.punctuation_bracket_desc": "Brackets and parentheses ({, }, (, ), [, ])",
|
|
908
|
+
"field.punctuation_delimiter": "Punctuation Delimiter",
|
|
909
|
+
"field.punctuation_delimiter_desc": "Delimiters and separators (;, ,, .)"
|
|
898
910
|
},
|
|
899
911
|
"es": {
|
|
900
912
|
"cmd.edit_theme": "Editar tema",
|
|
@@ -1193,7 +1205,11 @@
|
|
|
1193
1205
|
"field.popup_selection_fg": "Fondo de seleccion de ventana emergente",
|
|
1194
1206
|
"field.popup_selection_fg_desc": "Fondo de elemento seleccionado en ventana emergente",
|
|
1195
1207
|
"field.whitespace_indicator_fg": "Indicador de espacios en blanco primer plano",
|
|
1196
|
-
"field.whitespace_indicator_fg_desc": "Color de primer plano para indicadores de espacios en blanco (flechas de tabulación y puntos de espacio)"
|
|
1208
|
+
"field.whitespace_indicator_fg_desc": "Color de primer plano para indicadores de espacios en blanco (flechas de tabulación y puntos de espacio)",
|
|
1209
|
+
"field.punctuation_bracket": "Paréntesis",
|
|
1210
|
+
"field.punctuation_bracket_desc": "Paréntesis y corchetes ({, }, (, ), [, ])",
|
|
1211
|
+
"field.punctuation_delimiter": "Delimitador",
|
|
1212
|
+
"field.punctuation_delimiter_desc": "Delimitadores y separadores (;, ,, .)"
|
|
1197
1213
|
},
|
|
1198
1214
|
"fr": {
|
|
1199
1215
|
"cmd.edit_theme": "Modifier le theme",
|
|
@@ -1492,7 +1508,11 @@
|
|
|
1492
1508
|
"field.popup_selection_fg": "Premier plan selection popup",
|
|
1493
1509
|
"field.popup_selection_fg_desc": "Couleur du texte de l'element selectionne du popup",
|
|
1494
1510
|
"field.whitespace_indicator_fg": "Indicateur d'espaces premier plan",
|
|
1495
|
-
"field.whitespace_indicator_fg_desc": "Couleur de premier plan pour les indicateurs d'espaces (flèches de tabulation et points d'espace)"
|
|
1511
|
+
"field.whitespace_indicator_fg_desc": "Couleur de premier plan pour les indicateurs d'espaces (flèches de tabulation et points d'espace)",
|
|
1512
|
+
"field.punctuation_bracket": "Parenthese",
|
|
1513
|
+
"field.punctuation_bracket_desc": "Parentheses et crochets ({, }, (, ), [, ])",
|
|
1514
|
+
"field.punctuation_delimiter": "Delimiteur",
|
|
1515
|
+
"field.punctuation_delimiter_desc": "Delimiteurs et separateurs (;, ,, .)"
|
|
1496
1516
|
},
|
|
1497
1517
|
"ja": {
|
|
1498
1518
|
"cmd.edit_theme": "テーマを編集",
|
|
@@ -1791,7 +1811,11 @@
|
|
|
1791
1811
|
"field.popup_selection_fg": "ポップアップ選択前景",
|
|
1792
1812
|
"field.popup_selection_fg_desc": "ポップアップの選択項目の文字颜色",
|
|
1793
1813
|
"field.whitespace_indicator_fg": "空白インジケーター前景",
|
|
1794
|
-
"field.whitespace_indicator_fg_desc": "空白インジケーターの前景色(タブ矢印とスペースドット)"
|
|
1814
|
+
"field.whitespace_indicator_fg_desc": "空白インジケーターの前景色(タブ矢印とスペースドット)",
|
|
1815
|
+
"field.punctuation_bracket": "括弧",
|
|
1816
|
+
"field.punctuation_bracket_desc": "括弧 ({、}、(、)、[、])",
|
|
1817
|
+
"field.punctuation_delimiter": "区切り文字",
|
|
1818
|
+
"field.punctuation_delimiter_desc": "区切り文字 (;、,、.)"
|
|
1795
1819
|
},
|
|
1796
1820
|
"ko": {
|
|
1797
1821
|
"cmd.edit_theme": "편집 Theme",
|
|
@@ -2090,7 +2114,11 @@
|
|
|
2090
2114
|
"field.popup_selection_fg": "팝업 선택 전경",
|
|
2091
2115
|
"field.popup_selection_fg_desc": "팝업 selected item 텍스트 색상",
|
|
2092
2116
|
"field.whitespace_indicator_fg": "공백 표시기 전경",
|
|
2093
|
-
"field.whitespace_indicator_fg_desc": "공백 표시기의 전경색 (탭 화살표 및 공백 점)"
|
|
2117
|
+
"field.whitespace_indicator_fg_desc": "공백 표시기의 전경색 (탭 화살표 및 공백 점)",
|
|
2118
|
+
"field.punctuation_bracket": "괄호",
|
|
2119
|
+
"field.punctuation_bracket_desc": "괄호s ({, }, (, ), [, ])",
|
|
2120
|
+
"field.punctuation_delimiter": "구분자",
|
|
2121
|
+
"field.punctuation_delimiter_desc": "구분자s (;, ,, .)"
|
|
2094
2122
|
},
|
|
2095
2123
|
"pt-BR": {
|
|
2096
2124
|
"cmd.edit_theme": "editar Theme",
|
|
@@ -2389,7 +2417,11 @@
|
|
|
2389
2417
|
"field.popup_selection_fg": "popup seleção primeiro plano",
|
|
2390
2418
|
"field.popup_selection_fg_desc": "popup selected item texto cor",
|
|
2391
2419
|
"field.whitespace_indicator_fg": "Indicador de espaço em branco primeiro plano",
|
|
2392
|
-
"field.whitespace_indicator_fg_desc": "Cor de primeiro plano para indicadores de espaço em branco (setas de tabulação e pontos de espaço)"
|
|
2420
|
+
"field.whitespace_indicator_fg_desc": "Cor de primeiro plano para indicadores de espaço em branco (setas de tabulação e pontos de espaço)",
|
|
2421
|
+
"field.punctuation_bracket": "parêntese",
|
|
2422
|
+
"field.punctuation_bracket_desc": "parênteses ({, }, (, ), [, ])",
|
|
2423
|
+
"field.punctuation_delimiter": "delimitador",
|
|
2424
|
+
"field.punctuation_delimiter_desc": "delimitadors (;, ,, .)"
|
|
2393
2425
|
},
|
|
2394
2426
|
"ru": {
|
|
2395
2427
|
"cmd.edit_theme": "редактировать Theme",
|
|
@@ -2688,7 +2720,11 @@
|
|
|
2688
2720
|
"field.popup_selection_fg": "всплывающее окно выделение передний план",
|
|
2689
2721
|
"field.popup_selection_fg_desc": "всплывающее окно selected item текст цвет",
|
|
2690
2722
|
"field.whitespace_indicator_fg": "Индикатор пробелов передний план",
|
|
2691
|
-
"field.whitespace_indicator_fg_desc": "Цвет переднего плана для индикаторов пробелов (стрелки табуляции и точки пробелов)"
|
|
2723
|
+
"field.whitespace_indicator_fg_desc": "Цвет переднего плана для индикаторов пробелов (стрелки табуляции и точки пробелов)",
|
|
2724
|
+
"field.punctuation_bracket": "скобка",
|
|
2725
|
+
"field.punctuation_bracket_desc": "скобкаs ({, }, (, ), [, ])",
|
|
2726
|
+
"field.punctuation_delimiter": "разделитель",
|
|
2727
|
+
"field.punctuation_delimiter_desc": "разделительs (;, ,, .)"
|
|
2692
2728
|
},
|
|
2693
2729
|
"th": {
|
|
2694
2730
|
"cmd.edit_theme": "แก้ไข Theme",
|
|
@@ -2987,7 +3023,11 @@
|
|
|
2987
3023
|
"field.popup_selection_fg": "ป๊อปอัป การเลือก พื้นหน้า",
|
|
2988
3024
|
"field.popup_selection_fg_desc": "ป๊อปอัป selected item ข้อความ สี",
|
|
2989
3025
|
"field.whitespace_indicator_fg": "ตัวบ่งชี้ช่องว่างพื้นหน้า",
|
|
2990
|
-
"field.whitespace_indicator_fg_desc": "สีพื้นหน้าสำหรับตัวบ่งชี้ช่องว่าง (ลูกศรแท็บและจุดเว้นวรรค)"
|
|
3026
|
+
"field.whitespace_indicator_fg_desc": "สีพื้นหน้าสำหรับตัวบ่งชี้ช่องว่าง (ลูกศรแท็บและจุดเว้นวรรค)",
|
|
3027
|
+
"field.punctuation_bracket": "วงเล็บ",
|
|
3028
|
+
"field.punctuation_bracket_desc": "วงเล็บs ({, }, (, ), [, ])",
|
|
3029
|
+
"field.punctuation_delimiter": "ตัวคั่น",
|
|
3030
|
+
"field.punctuation_delimiter_desc": "ตัวคั่นs (;, ,, .)"
|
|
2991
3031
|
},
|
|
2992
3032
|
"uk": {
|
|
2993
3033
|
"cmd.edit_theme": "редагувати Theme",
|
|
@@ -3286,7 +3326,11 @@
|
|
|
3286
3326
|
"field.popup_selection_fg": "спливаюче вікно виділення передний план",
|
|
3287
3327
|
"field.popup_selection_fg_desc": "спливаюче вікно selected item текст цвет",
|
|
3288
3328
|
"field.whitespace_indicator_fg": "Індикатор пробілів передній план",
|
|
3289
|
-
"field.whitespace_indicator_fg_desc": "Колір переднього плану для індикаторів пробілів (стрілки табуляції та крапки пробілів)"
|
|
3329
|
+
"field.whitespace_indicator_fg_desc": "Колір переднього плану для індикаторів пробілів (стрілки табуляції та крапки пробілів)",
|
|
3330
|
+
"field.punctuation_bracket": "дужка",
|
|
3331
|
+
"field.punctuation_bracket_desc": "дужкаs ({, }, (, ), [, ])",
|
|
3332
|
+
"field.punctuation_delimiter": "роздільник",
|
|
3333
|
+
"field.punctuation_delimiter_desc": "роздільникs (;, ,, .)"
|
|
3290
3334
|
},
|
|
3291
3335
|
"vi": {
|
|
3292
3336
|
"cmd.edit_theme": "Chỉnh sửa giao diện",
|
|
@@ -3585,7 +3629,11 @@
|
|
|
3585
3629
|
"field.popup_selection_fg": "Tiền cảnh lựa chọn cửa sổ bật lên",
|
|
3586
3630
|
"field.popup_selection_fg_desc": "Màu văn bản mục đã chọn trong cửa sổ bật lên",
|
|
3587
3631
|
"field.whitespace_indicator_fg": "Chỉ báo khoảng trắng tiền cảnh",
|
|
3588
|
-
"field.whitespace_indicator_fg_desc": "Màu tiền cảnh cho chỉ báo khoảng trắng (mũi tên tab và dấu chấm khoảng trắng)"
|
|
3632
|
+
"field.whitespace_indicator_fg_desc": "Màu tiền cảnh cho chỉ báo khoảng trắng (mũi tên tab và dấu chấm khoảng trắng)",
|
|
3633
|
+
"field.punctuation_bracket": "Dấu ngoặc",
|
|
3634
|
+
"field.punctuation_bracket_desc": "Dấu ngoặc ({, }, (, ), [, ])",
|
|
3635
|
+
"field.punctuation_delimiter": "Dấu phân cách",
|
|
3636
|
+
"field.punctuation_delimiter_desc": "Dấu phân cách (;, ,, .)"
|
|
3589
3637
|
},
|
|
3590
3638
|
"zh-CN": {
|
|
3591
3639
|
"cmd.edit_theme": "编辑主题",
|
|
@@ -3884,7 +3932,11 @@
|
|
|
3884
3932
|
"field.popup_selection_fg": "弹出窗口选择前景",
|
|
3885
3933
|
"field.popup_selection_fg_desc": "弹出窗口选中项文字颜色",
|
|
3886
3934
|
"field.whitespace_indicator_fg": "空白指示器前景",
|
|
3887
|
-
"field.whitespace_indicator_fg_desc": "空白指示器的前景颜色(制表符箭头和空格点)"
|
|
3935
|
+
"field.whitespace_indicator_fg_desc": "空白指示器的前景颜色(制表符箭头和空格点)",
|
|
3936
|
+
"field.punctuation_bracket": "括号",
|
|
3937
|
+
"field.punctuation_bracket_desc": "括号 ({、}、(、)、[、])",
|
|
3938
|
+
"field.punctuation_delimiter": "分隔符",
|
|
3939
|
+
"field.punctuation_delimiter_desc": "分隔符 (;、,、.)"
|
|
3888
3940
|
},
|
|
3889
3941
|
"it": {
|
|
3890
3942
|
"cmd.edit_theme": "Modifica tema",
|
|
@@ -4183,6 +4235,10 @@
|
|
|
4183
4235
|
"field.popup_selection_fg": "Primo piano selezione popup",
|
|
4184
4236
|
"field.popup_selection_fg_desc": "Colore del testo dell elemento selezionato nel popup",
|
|
4185
4237
|
"field.whitespace_indicator_fg": "Indicatore spazi bianchi primo piano",
|
|
4186
|
-
"field.whitespace_indicator_fg_desc": "Colore primo piano per gli indicatori di spazi bianchi (frecce di tabulazione e punti di spazio)"
|
|
4238
|
+
"field.whitespace_indicator_fg_desc": "Colore primo piano per gli indicatori di spazi bianchi (frecce di tabulazione e punti di spazio)",
|
|
4239
|
+
"field.punctuation_bracket": "Parentesi",
|
|
4240
|
+
"field.punctuation_bracket_desc": "Parentesi e parentesi quadre ({, }, (, ), [, ])",
|
|
4241
|
+
"field.punctuation_delimiter": "Delimitatore",
|
|
4242
|
+
"field.punctuation_delimiter_desc": "Delimitatori e separatori (;, ,, .)"
|
|
4187
4243
|
}
|
|
4188
4244
|
}
|