Skip to content

Commit af6e007

Browse files
Show Language Server Menu, Adjust Warning, Add Info Button (#2109)
### Description Adjusts the language server menu slightly to include a more reasonable danger warning and an info button. Since we're shipping this I'd like to have some kind of explainer for someone poking around. ### Related Issues ### Checklist - [x] I read and understood the [contributing guide](https://github.com/CodeEditApp/CodeEdit/blob/main/CONTRIBUTING.md) as well as the [code of conduct](https://github.com/CodeEditApp/CodeEdit/blob/main/CODE_OF_CONDUCT.md) - [x] The issues this PR addresses are related to each other - [x] My changes generate no new warnings - [x] My code builds and runs on my machine - [x] My changes are all related to the related issue above - [x] I documented my code ### Screenshots <img width="1798" height="1410" alt="Screenshot 2025-08-25 at 10 45 05 AM" src="https://github.com/user-attachments/assets/a6fa3eb8-7d25-4923-bfbb-284ee19f7a74" />
1 parent 31a84d7 commit af6e007

File tree

2 files changed

+47
-14
lines changed

2 files changed

+47
-14
lines changed

CodeEdit/Features/Settings/Pages/Extensions/LanguageServersView.swift

Lines changed: 46 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,10 @@ struct LanguageServersView: View {
1313
@State private var registryItems: [RegistryItem] = []
1414
@State private var isLoading = true
1515

16+
@State private var showingInfoPanel = false
17+
1618
var body: some View {
1719
SettingsForm {
18-
Section {
19-
EmptyView()
20-
} header: {
21-
Label(
22-
"Warning: Language server installation is not complete. Use this at your own risk. It "
23-
+ "**WILL** break.",
24-
systemImage: "exclamationmark.triangle.fill"
25-
)
26-
.padding()
27-
.foregroundStyle(.black)
28-
.background(RoundedRectangle(cornerRadius: 12).fill(.yellow))
29-
}
30-
3120
if isLoading {
3221
HStack {
3322
Spacer()
@@ -61,6 +50,11 @@ struct LanguageServersView: View {
6150
)
6251
.listRowInsets(EdgeInsets(top: 8, leading: 8, bottom: 8, trailing: 8))
6352
}
53+
} header: {
54+
Label(
55+
"Warning: Language server installation is experimental. Use at your own risk.",
56+
systemImage: "exclamationmark.triangle.fill"
57+
)
6458
}
6559
}
6660
}
@@ -82,6 +76,28 @@ struct LanguageServersView: View {
8276
} message: { details in
8377
Text(details.error)
8478
}
79+
.toolbar {
80+
Button {
81+
showingInfoPanel.toggle()
82+
} label: {
83+
Image(systemName: "questionmark.circle")
84+
}
85+
.buttonStyle(.plain)
86+
.foregroundStyle(.secondary)
87+
.popover(isPresented: $showingInfoPanel, arrowEdge: .top) {
88+
VStack(alignment: .leading) {
89+
HStack {
90+
Text("Language Server Installation").font(.title2)
91+
Spacer()
92+
}
93+
.frame(width: 300)
94+
Text(getInfoString())
95+
.lineLimit(nil)
96+
.frame(width: 300)
97+
}
98+
.padding()
99+
}
100+
}
85101
}
86102

87103
private func loadRegistryItems() {
@@ -91,6 +107,23 @@ struct LanguageServersView: View {
91107
isLoading = false
92108
}
93109
}
110+
111+
private func getInfoString() -> AttributedString {
112+
let string = "CodeEdit makes use of the Mason Registry for language server installation. To install a package, "
113+
+ "CodeEdit uses the package manager directed by the Mason Registry, and installs a copy of "
114+
+ "the language server in Application Support.\n\n"
115+
+ "Language server installation is still experimental, there may be bugs and expect this flow "
116+
+ "to change over time."
117+
118+
var attrString = AttributedString(string)
119+
120+
if let linkRange = attrString.range(of: "Mason Registry") {
121+
attrString[linkRange].link = URL(string: "https://mason-registry.dev/")
122+
attrString[linkRange].foregroundColor = NSColor.linkColor
123+
}
124+
125+
return attrString
126+
}
94127
}
95128

96129
private struct InstallationFailure: Identifiable {

CodeEdit/Features/Settings/SettingsView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ struct SettingsView: View {
141141
SettingsPageView(page, searchText: searchText)
142142
}
143143
} else if !page.isSetting {
144-
if (page.name == .developer || page.name == .languageServers) && !showDeveloperSettings {
144+
if page.name == .developer && !showDeveloperSettings {
145145
EmptyView()
146146
} else {
147147
SettingsPageView(page, searchText: searchText)

0 commit comments

Comments
 (0)