Skip to content

Commit 4849bbd

Browse files
1 parent 67ccd2f commit 4849bbd

13 files changed

Lines changed: 767 additions & 323 deletions

File tree

README.md

Lines changed: 269 additions & 63 deletions
Large diffs are not rendered by default.

SECURITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ not limited to):**
5959
- **Denial of Service (DoS):** If an Element can be made unresponsive or crash
6060
due to specially crafted input or excessive resource consumption.
6161
- **Path Traversal/Arbitrary File Access:** For Elements interacting with the
62-
filesystem (like `Mountain`'s FS handlers), ensuring that
63-
path inputs are properly sanitized.
62+
filesystem (like `Mountain`'s FS handlers), ensuring that path inputs are
63+
properly sanitized.
6464
- **Insecure IPC/Communication:** For Elements involved in inter-process
6565
communication (`Vine`, `Track`, `Echo`, `Mist`), vulnerabilities in the
6666
protocol or handling of messages.

Source/API/types.rs

Lines changed: 50 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -242,49 +242,56 @@ impl CompletionItem {
242242
/// Completion item kind
243243
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
244244
pub enum CompletionItemKind {
245-
/// Text completion
246-
Text = 1,
247-
/// Method completion
248-
Method = 2,
249-
/// Function completion
250-
Function = 3,
251-
/// Constructor completion
252-
Constructor = 4,
253-
/// Field completion
254-
Field = 5,
255-
/// Variable completion
256-
Variable = 6,
257-
/// Class completion
258-
Class = 7,
259-
/// Interface completion
260-
Interface = 8,
261-
/// Module completion
262-
Module = 9,
263-
/// Property completion
264-
Property = 10,
265-
/// Unit completion
266-
Unit = 11,
267-
/// Value completion
268-
Value = 12,
269-
/// Enum completion
270-
Enum = 13,
271-
/// Keyword completion
272-
Keyword = 14,
273-
/// Snippet completion
274-
Snippet = 15,
275-
/// Color completion
276-
Color = 16,
277-
/// File completion
278-
File = 17,
279-
/// Reference completion
280-
Reference = 18,
281-
Folder = 19,
282-
EnumMember = 20,
283-
Constant = 21,
284-
Struct = 22,
285-
Event = 23,
286-
Operator = 24,
287-
TypeParameter = 25,
245+
/// Text completion
246+
Text = 1,
247+
/// Method completion
248+
Method = 2,
249+
/// Function completion
250+
Function = 3,
251+
/// Constructor completion
252+
Constructor = 4,
253+
/// Field completion
254+
Field = 5,
255+
/// Variable completion
256+
Variable = 6,
257+
/// Class completion
258+
Class = 7,
259+
/// Interface completion
260+
Interface = 8,
261+
/// Module completion
262+
Module = 9,
263+
/// Property completion
264+
Property = 10,
265+
/// Unit completion
266+
Unit = 11,
267+
/// Value completion
268+
Value = 12,
269+
/// Enum completion
270+
Enum = 13,
271+
/// Keyword completion
272+
Keyword = 14,
273+
/// Snippet completion
274+
Snippet = 15,
275+
/// Color completion
276+
Color = 16,
277+
/// File completion
278+
File = 17,
279+
/// Reference completion
280+
Reference = 18,
281+
/// Folder completion
282+
Folder = 19,
283+
/// Enum member completion
284+
EnumMember = 20,
285+
/// Constant completion
286+
Constant = 21,
287+
/// Struct completion
288+
Struct = 22,
289+
/// Event completion
290+
Event = 23,
291+
/// Operator completion
292+
Operator = 24,
293+
/// Type parameter completion
294+
TypeParameter = 25,
288295
}
289296

290297
/// Completion item documentation

Source/API/vscode.rs

Lines changed: 63 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ impl Default for VSCodeAPI {
5050
pub struct Commands;
5151

5252
impl Commands {
53-
pub fn new() -> Self { Self }
53+
/// Create a new Commands instance
54+
pub fn new() -> Self { Self }
5455

5556
/// Register a command
5657
pub fn register_command(&self, command_id:String, callback:CommandCallback) -> Result<Command, String> {
@@ -74,15 +75,17 @@ pub type CommandCallback = Box<dyn Fn(Vec<serde_json::Value>) -> Result<serde_js
7475
/// Command representation
7576
#[derive(Debug, Clone)]
7677
pub struct Command {
77-
pub id:String,
78+
/// The unique identifier of the command
79+
pub id:String,
7880
}
7981

8082
/// Window namespace
8183
#[derive(Debug, Clone)]
8284
pub struct Window;
8385

8486
impl Window {
85-
pub fn new() -> Self { Self }
87+
/// Create a new Window instance
88+
pub fn new() -> Self { Self }
8689

8790
/// Show an information message
8891
pub async fn show_information_message(&self, message:String) -> Result<String, String> {
@@ -109,11 +112,17 @@ impl Window {
109112
/// Output channel for logging
110113
#[derive(Debug, Clone)]
111114
pub struct OutputChannel {
112-
name:String,
115+
/// The name of the output channel
116+
name:String,
113117
}
114118

115119
impl OutputChannel {
116-
pub fn new(name:String) -> Self { Self { name } }
120+
/// Create a new output channel
121+
///
122+
/// # Arguments
123+
///
124+
/// * `name` - The name of the output channel
125+
pub fn new(name:String) -> Self { Self { name } }
117126

118127
/// Append a line to the channel
119128
pub fn append_line(&self, line:&str) {
@@ -146,7 +155,8 @@ impl OutputChannel {
146155
pub struct Workspace;
147156

148157
impl Workspace {
149-
pub fn new() -> Self { Self }
158+
/// Create a new Workspace instance
159+
pub fn new() -> Self { Self }
150160

151161
/// Get workspace folders
152162
pub fn workspace_folders(&self) -> Vec<WorkspaceFolder> {
@@ -176,11 +186,17 @@ pub struct WorkspaceFolder {
176186
/// Workspace configuration
177187
#[derive(Debug, Clone)]
178188
pub struct WorkspaceConfiguration {
179-
section:Option<String>,
189+
/// The configuration section name
190+
section:Option<String>,
180191
}
181192

182193
impl WorkspaceConfiguration {
183-
pub fn new(section:Option<String>) -> Self { Self { section } }
194+
/// Create a new workspace configuration
195+
///
196+
/// # Arguments
197+
///
198+
/// * `section` - Optional section name to retrieve
199+
pub fn new(section:Option<String>) -> Self { Self { section } }
184200

185201
/// Get a configuration value
186202
pub fn get<T:serde::de::DeserializeOwned>(&self, key:String) -> Result<T, String> {
@@ -203,7 +219,8 @@ impl WorkspaceConfiguration {
203219
pub struct Languages;
204220

205221
impl Languages {
206-
pub fn new() -> Self { Self }
222+
/// Create a new Languages instance
223+
pub fn new() -> Self { Self }
207224

208225
/// Register completion item provider
209226
pub async fn register_completion_item_provider<T:CompletionItemProvider>(
@@ -239,13 +256,25 @@ pub type DocumentSelector = Vec<DocumentFilter>;
239256

240257
/// Completion item provider
241258
pub trait CompletionItemProvider: Send + Sync {
242-
fn provide_completion_items(
243-
&self,
244-
document:TextDocumentIdentifier,
245-
position:Position,
246-
context:CompletionContext,
247-
token:Option<String>,
248-
) -> Vec<CompletionItem>;
259+
/// Provide completion items at the given position
260+
///
261+
/// # Arguments
262+
///
263+
/// * `document` - The text document identifier
264+
/// * `position` - The position in the document
265+
/// * `context` - The completion context
266+
/// * `token` - Optional cancellation token
267+
///
268+
/// # Returns
269+
///
270+
/// A vector of completion items
271+
fn provide_completion_items(
272+
&self,
273+
document:TextDocumentIdentifier,
274+
position:Position,
275+
context:CompletionContext,
276+
token:Option<String>,
277+
) -> Vec<CompletionItem>;
249278
}
250279

251280
/// Completion context
@@ -279,11 +308,17 @@ pub enum CompletionTriggerKind {
279308
/// Diagnostic collection
280309
#[derive(Debug, Clone)]
281310
pub struct DiagnosticCollection {
282-
name:Option<String>,
311+
/// The name of the diagnostic collection
312+
name:Option<String>,
283313
}
284314

285315
impl DiagnosticCollection {
286-
pub fn new(name:Option<String>) -> Self { Self { name } }
316+
/// Create a new diagnostic collection
317+
///
318+
/// # Arguments
319+
///
320+
/// * `name` - Optional name for the collection
321+
pub fn new(name:Option<String>) -> Self { Self { name } }
287322

288323
/// Set diagnostics for a resource
289324
pub fn set(&self, uri:String, diagnostics:Vec<Diagnostic>) {
@@ -311,19 +346,22 @@ impl DiagnosticCollection {
311346
pub struct Disposable;
312347

313348
impl Disposable {
314-
pub fn new() -> Self { Self }
349+
/// Create a new disposable item
350+
pub fn new() -> Self { Self }
315351

316-
pub fn dispose(&self) {
317-
// Placeholder implementation
318-
}
352+
/// Dispose the resource
353+
pub fn dispose(&self) {
354+
// Placeholder implementation
355+
}
319356
}
320357

321358
/// Extensions namespace
322359
#[derive(Debug, Clone)]
323360
pub struct Extensions;
324361

325362
impl Extensions {
326-
pub fn new() -> Self { Self }
363+
/// Create a new Extensions instance
364+
pub fn new() -> Self { Self }
327365

328366
/// Get all extensions
329367
pub fn all(&self) -> Vec<Extension> { Vec::new() }
@@ -355,7 +393,8 @@ pub struct Extension {
355393
pub struct Env;
356394

357395
impl Env {
358-
pub fn new() -> Self { Self }
396+
/// Create a new Env instance
397+
pub fn new() -> Self { Self }
359398

360399
/// Get environment variable
361400
pub fn get_env_var(&self, name:String) -> Option<String> { std::env::var(name).ok() }

0 commit comments

Comments
 (0)