@@ -20,17 +20,12 @@ use tower::{Service, ServiceExt};
20
20
use tower_lsp:: jsonrpc;
21
21
use tower_lsp:: jsonrpc:: Response ;
22
22
use tower_lsp:: lsp_types as lsp;
23
- use tower_lsp:: lsp_types:: DidCloseTextDocumentParams ;
24
- use tower_lsp:: lsp_types:: DidOpenTextDocumentParams ;
25
- use tower_lsp:: lsp_types:: InitializeResult ;
26
- use tower_lsp:: lsp_types:: InitializedParams ;
27
- use tower_lsp:: lsp_types:: PublishDiagnosticsParams ;
28
- use tower_lsp:: lsp_types:: TextDocumentContentChangeEvent ;
29
- use tower_lsp:: lsp_types:: TextDocumentIdentifier ;
30
- use tower_lsp:: lsp_types:: TextDocumentItem ;
31
- use tower_lsp:: lsp_types:: VersionedTextDocumentIdentifier ;
32
- use tower_lsp:: lsp_types:: { ClientCapabilities , Url } ;
33
- use tower_lsp:: lsp_types:: { DidChangeConfigurationParams , DidChangeTextDocumentParams } ;
23
+ use tower_lsp:: lsp_types:: {
24
+ ClientCapabilities , DidChangeConfigurationParams , DidChangeTextDocumentParams ,
25
+ DidCloseTextDocumentParams , DidOpenTextDocumentParams , InitializeResult , InitializedParams ,
26
+ PublishDiagnosticsParams , TextDocumentContentChangeEvent , TextDocumentIdentifier ,
27
+ TextDocumentItem , Url , VersionedTextDocumentIdentifier ,
28
+ } ;
34
29
use tower_lsp:: LspService ;
35
30
use tower_lsp:: { jsonrpc:: Request , lsp_types:: InitializeParams } ;
36
31
@@ -181,23 +176,8 @@ impl Server {
181
176
"textDocument/didOpen" ,
182
177
DidOpenTextDocumentParams {
183
178
text_document : TextDocumentItem {
184
- uri : url ! ( "document.js" ) ,
185
- language_id : String :: from ( "javascript" ) ,
186
- version : 0 ,
187
- text : text. to_string ( ) ,
188
- } ,
189
- } ,
190
- )
191
- . await
192
- }
193
-
194
- async fn open_untitled_document ( & mut self , text : impl Display ) -> Result < ( ) > {
195
- self . notify (
196
- "textDocument/didOpen" ,
197
- DidOpenTextDocumentParams {
198
- text_document : TextDocumentItem {
199
- uri : url ! ( "untitled-1" ) ,
200
- language_id : String :: from ( "javascript" ) ,
179
+ uri : url ! ( "document.sql" ) ,
180
+ language_id : String :: from ( "sql" ) ,
201
181
version : 0 ,
202
182
text : text. to_string ( ) ,
203
183
} ,
@@ -207,18 +187,13 @@ impl Server {
207
187
}
208
188
209
189
/// Opens a document with given contents and given name. The name must contain the extension too
210
- async fn open_named_document (
211
- & mut self ,
212
- text : impl Display ,
213
- document_name : Url ,
214
- language : impl Display ,
215
- ) -> Result < ( ) > {
190
+ async fn open_named_document ( & mut self , text : impl Display , document_name : Url ) -> Result < ( ) > {
216
191
self . notify (
217
192
"textDocument/didOpen" ,
218
193
DidOpenTextDocumentParams {
219
194
text_document : TextDocumentItem {
220
195
uri : document_name,
221
- language_id : language . to_string ( ) ,
196
+ language_id : String :: from ( "sql" ) ,
222
197
version : 0 ,
223
198
text : text. to_string ( ) ,
224
199
} ,
@@ -247,7 +222,7 @@ impl Server {
247
222
"textDocument/didChange" ,
248
223
DidChangeTextDocumentParams {
249
224
text_document : VersionedTextDocumentIdentifier {
250
- uri : url ! ( "document.js " ) ,
225
+ uri : url ! ( "document.sql " ) ,
251
226
version,
252
227
} ,
253
228
content_changes,
@@ -261,7 +236,7 @@ impl Server {
261
236
"textDocument/didClose" ,
262
237
DidCloseTextDocumentParams {
263
238
text_document : TextDocumentIdentifier {
264
- uri : url ! ( "document.js " ) ,
239
+ uri : url ! ( "document.sql " ) ,
265
240
} ,
266
241
} ,
267
242
)
0 commit comments