@fresh-editor/fresh-editor 0.2.17 → 0.2.20
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 +144 -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 +275 -29
- package/plugins/dart-lsp.ts +144 -0
- package/plugins/diagnostics_panel.ts +4 -12
- package/plugins/diff_nav.i18n.json +128 -0
- package/plugins/diff_nav.ts +196 -0
- package/plugins/elixir-lsp.ts +120 -0
- package/plugins/erlang-lsp.ts +121 -0
- package/plugins/fsharp-lsp.ts +125 -0
- package/plugins/git_gutter.ts +5 -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/finder.ts +19 -12
- package/plugins/lib/fresh.d.ts +30 -1
- 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 +37 -76
- 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/schemas/package.schema.json +437 -272
- package/plugins/schemas/theme.schema.json +18 -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
|
+
* Scala LSP Helper Plugin
|
|
6
|
+
*
|
|
7
|
+
* Server: Metals (scalameta.org/metals)
|
|
8
|
+
* VS Code: "Scala (Metals)" extension
|
|
9
|
+
* Neovim: nvim-metals plugin (recommended over nvim-lspconfig)
|
|
10
|
+
* Requires: Java 11+ and Coursier
|
|
11
|
+
* Supports: sbt, Mill, Gradle, Maven via Bloop/BSP
|
|
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
|
+
coursier: "cs install metals",
|
|
33
|
+
brew_cs: "brew install coursier/formulas/coursier && cs install metals",
|
|
34
|
+
manual: "curl -fL https://github.com/coursier/coursier/releases/latest/download/cs-x86_64-pc-linux.gz | gzip -d > cs && chmod +x cs && ./cs install metals",
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
let scalaLspError: { serverCommand: string; message: string } | null = null;
|
|
38
|
+
|
|
39
|
+
function on_scala_lsp_server_error(data: LspServerErrorData): void {
|
|
40
|
+
if (data.language !== "scala") {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
editor.debug(`scala-lsp: Server error - ${data.error_type}: ${data.message}`);
|
|
45
|
+
|
|
46
|
+
scalaLspError = {
|
|
47
|
+
serverCommand: data.server_command,
|
|
48
|
+
message: data.message,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
if (data.error_type === "not_found") {
|
|
52
|
+
editor.setStatus(
|
|
53
|
+
`Scala LSP server '${data.server_command}' not found. Click status bar for help.`
|
|
54
|
+
);
|
|
55
|
+
} else {
|
|
56
|
+
editor.setStatus(`Scala LSP error: ${data.message}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
registerHandler("on_scala_lsp_server_error", on_scala_lsp_server_error);
|
|
60
|
+
editor.on("lsp_server_error", "on_scala_lsp_server_error");
|
|
61
|
+
|
|
62
|
+
function on_scala_lsp_status_clicked(data: LspStatusClickedData): void {
|
|
63
|
+
if (data.language !== "scala" || !scalaLspError) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
editor.debug("scala-lsp: Status clicked, showing help popup");
|
|
68
|
+
|
|
69
|
+
editor.showActionPopup({
|
|
70
|
+
id: "scala-lsp-help",
|
|
71
|
+
title: "Scala Language Server Not Found",
|
|
72
|
+
message: `"${scalaLspError.serverCommand}" (Metals) provides completion, diagnostics, refactoring, and debugging for Scala. Requires Java 11+ and Coursier.\n\nSupports sbt, Mill, Gradle, Maven via Bloop/BSP.\nVS Code users: Install "Scala (Metals)" extension.\nNeovim users: Use nvim-metals plugin.\nSee: https://scalameta.org/metals/docs/editors/overview`,
|
|
73
|
+
actions: [
|
|
74
|
+
{ id: "copy_coursier", label: `Copy: ${INSTALL_COMMANDS.coursier}` },
|
|
75
|
+
{ id: "copy_brew", label: `Copy: ${INSTALL_COMMANDS.brew_cs}` },
|
|
76
|
+
{ id: "disable", label: "Disable Scala LSP" },
|
|
77
|
+
{ id: "dismiss", label: "Dismiss (ESC)" },
|
|
78
|
+
],
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
registerHandler("on_scala_lsp_status_clicked", on_scala_lsp_status_clicked);
|
|
82
|
+
editor.on("lsp_status_clicked", "on_scala_lsp_status_clicked");
|
|
83
|
+
|
|
84
|
+
function on_scala_lsp_action_result(data: ActionPopupResultData): void {
|
|
85
|
+
if (data.popup_id !== "scala-lsp-help") {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
editor.debug(`scala-lsp: Action selected - ${data.action_id}`);
|
|
90
|
+
|
|
91
|
+
switch (data.action_id) {
|
|
92
|
+
case "copy_coursier":
|
|
93
|
+
editor.setClipboard(INSTALL_COMMANDS.coursier);
|
|
94
|
+
editor.setStatus("Copied: " + INSTALL_COMMANDS.coursier);
|
|
95
|
+
break;
|
|
96
|
+
|
|
97
|
+
case "copy_brew":
|
|
98
|
+
editor.setClipboard(INSTALL_COMMANDS.brew_cs);
|
|
99
|
+
editor.setStatus("Copied: " + INSTALL_COMMANDS.brew_cs);
|
|
100
|
+
break;
|
|
101
|
+
|
|
102
|
+
case "disable":
|
|
103
|
+
editor.disableLspForLanguage("scala");
|
|
104
|
+
editor.setStatus("Scala LSP disabled");
|
|
105
|
+
scalaLspError = null;
|
|
106
|
+
break;
|
|
107
|
+
|
|
108
|
+
case "dismiss":
|
|
109
|
+
case "dismissed":
|
|
110
|
+
break;
|
|
111
|
+
|
|
112
|
+
default:
|
|
113
|
+
editor.debug(`scala-lsp: Unknown action: ${data.action_id}`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
registerHandler("on_scala_lsp_action_result", on_scala_lsp_action_result);
|
|
117
|
+
editor.on("action_popup_result", "on_scala_lsp_action_result");
|
|
118
|
+
|
|
119
|
+
editor.debug("scala-lsp: Plugin loaded");
|