forked from argotorg/fe
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcapabilities.rs
More file actions
175 lines (172 loc) · 8.6 KB
/
Copy pathcapabilities.rs
File metadata and controls
175 lines (172 loc) · 8.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
use async_lsp::lsp_types::{HoverProviderCapability, OneOf, ServerCapabilities};
use super::semantic_tokens::semantic_tokens_options;
#[cfg(target_arch = "wasm32")]
use crate::util::DummyFilePathConversion;
pub(crate) fn server_capabilities() -> ServerCapabilities {
ServerCapabilities {
hover_provider: Some(HoverProviderCapability::Simple(true)),
// full sync mode for now
text_document_sync: Some(async_lsp::lsp_types::TextDocumentSyncCapability::Kind(
async_lsp::lsp_types::TextDocumentSyncKind::FULL,
)),
// goto definition
definition_provider: Some(async_lsp::lsp_types::OneOf::Left(true)),
// find all references
references_provider: Some(async_lsp::lsp_types::OneOf::Left(true)),
// document highlight
document_highlight_provider: Some(async_lsp::lsp_types::OneOf::Left(true)),
// go to type definition
type_definition_provider: Some(
async_lsp::lsp_types::TypeDefinitionProviderCapability::Simple(true),
),
// go to implementation
implementation_provider: Some(
async_lsp::lsp_types::ImplementationProviderCapability::Simple(true),
),
// rename symbol
rename_provider: Some(async_lsp::lsp_types::OneOf::Left(true)),
// semantic tokens
semantic_tokens_provider: Some(semantic_tokens_options()),
// formatting
document_formatting_provider: Some(OneOf::Left(true)),
// inlay hints
inlay_hint_provider: Some(async_lsp::lsp_types::OneOf::Left(true)),
// document symbols
document_symbol_provider: Some(async_lsp::lsp_types::OneOf::Left(true)),
// workspace symbols
workspace_symbol_provider: Some(async_lsp::lsp_types::OneOf::Left(true)),
// completion
completion_provider: Some(async_lsp::lsp_types::CompletionOptions {
resolve_provider: Some(false),
trigger_characters: Some(vec![".".to_string(), ":".to_string()]),
all_commit_characters: None,
work_done_progress_options: Default::default(),
completion_item: None,
}),
// signature help
signature_help_provider: Some(async_lsp::lsp_types::SignatureHelpOptions {
trigger_characters: Some(vec!["(".to_string(), ",".to_string()]),
retrigger_characters: Some(vec![",".to_string()]),
work_done_progress_options: Default::default(),
}),
// call hierarchy
call_hierarchy_provider: Some(async_lsp::lsp_types::CallHierarchyServerCapability::Simple(
true,
)),
// type hierarchy: handlers are registered but lsp-types 0.95.1 doesn't
// expose type_hierarchy_provider on ServerCapabilities; clients that
// discover support dynamically (e.g. via request probing) will still work.
// code lens
code_lens_provider: Some(async_lsp::lsp_types::CodeLensOptions {
resolve_provider: Some(false),
}),
// selection range
selection_range_provider: Some(
async_lsp::lsp_types::SelectionRangeProviderCapability::Simple(true),
),
// folding range
folding_range_provider: Some(
async_lsp::lsp_types::FoldingRangeProviderCapability::Simple(true),
),
// go to declaration
declaration_provider: Some(async_lsp::lsp_types::DeclarationCapability::Simple(true)),
// code actions (quick fixes)
code_action_provider: Some(async_lsp::lsp_types::CodeActionProviderCapability::Simple(
true,
)),
// execute command (codegen views)
execute_command_provider: Some(async_lsp::lsp_types::ExecuteCommandOptions {
commands: vec![
"fe.viewMir".into(),
"fe.viewSonatinaIr".into(),
"fe.openDocs".into(),
],
..Default::default()
}),
// support for workspace add/remove changes
workspace: Some(async_lsp::lsp_types::WorkspaceServerCapabilities {
workspace_folders: Some(async_lsp::lsp_types::WorkspaceFoldersServerCapabilities {
supported: Some(true),
change_notifications: Some(async_lsp::lsp_types::OneOf::Left(true)),
}),
file_operations: Some(
async_lsp::lsp_types::WorkspaceFileOperationsServerCapabilities {
did_create: Some(async_lsp::lsp_types::FileOperationRegistrationOptions {
filters: vec![async_lsp::lsp_types::FileOperationFilter {
scheme: Some(String::from("file")),
pattern: async_lsp::lsp_types::FileOperationPattern {
glob: String::from("**/*"),
options: None,
// options: Some(async_lsp::lsp_types::FileOperationPatternOptions {
// ignore_case: Some(true),
// }),
matches: None,
},
}],
}),
did_rename: Some(async_lsp::lsp_types::FileOperationRegistrationOptions {
filters: vec![async_lsp::lsp_types::FileOperationFilter {
scheme: Some(String::from("file")),
pattern: async_lsp::lsp_types::FileOperationPattern {
glob: String::from("**/*"),
options: None,
// options: Some(async_lsp::lsp_types::FileOperationPatternOptions {
// ignore_case: Some(true),
// }),
matches: None,
},
}],
}),
did_delete: Some(async_lsp::lsp_types::FileOperationRegistrationOptions {
filters: vec![async_lsp::lsp_types::FileOperationFilter {
scheme: Some(String::from("file")),
pattern: async_lsp::lsp_types::FileOperationPattern {
glob: String::from("**/*"),
options: None,
// options: Some(async_lsp::lsp_types::FileOperationPatternOptions {
// ignore_case: Some(true),
// }),
matches: None,
},
}],
}),
will_create: None,
will_rename: None,
will_delete: None,
// TODO: implement file operation refactors and workspace cache updates
// will_create: Some(async_lsp::lsp_types::FileOperationRegistrationOptions {
// filters: vec![async_lsp::lsp_types::FileOperationFilter {
// scheme: Some(String::from("file")),
// pattern: async_lsp::lsp_types::FileOperationPattern {
// glob: String::from("**/*"),
// options: None,
// matches: None,
// },
// }],
// }),
// will_rename: Some(async_lsp::lsp_types::FileOperationRegistrationOptions {
// filters: vec![async_lsp::lsp_types::FileOperationFilter {
// scheme: Some(String::from("file")),
// pattern: async_lsp::lsp_types::FileOperationPattern {
// glob: String::from("**/*"),
// options: None,
// matches: None,
// },
// }],
// }),
// will_delete: Some(async_lsp::lsp_types::FileOperationRegistrationOptions {
// filters: vec![async_lsp::lsp_types::FileOperationFilter {
// scheme: Some(String::from("file")),
// pattern: async_lsp::lsp_types::FileOperationPattern {
// glob: String::from("**/*"),
// options: None,
// matches: None,
// },
// }],
// }),
},
),
}),
..Default::default()
}
}