File tree Expand file tree Collapse file tree 4 files changed +45
-8
lines changed
example/monaco_editor/src/client Expand file tree Collapse file tree 4 files changed +45
-8
lines changed Original file line number Diff line number Diff line change @@ -5,8 +5,8 @@ services:
5
5
context : .
6
6
dockerfile : dockerfile
7
7
volumes :
8
- - .:/opt/sql-language-server/ rw
9
- command : ' yarn run dev'
8
+ - .:/opt/sql-language-server: rw
9
+ command : ' yarn dev ' # 'tail -f / dev/null '
10
10
ports :
11
11
- ' 3000:3000'
12
12
postgres :
Original file line number Diff line number Diff line change 1
1
FROM node:12
2
2
3
- COPY . /opt/sql-language-server
3
+ COPY ./example /opt/sql-language-server/example
4
+ COPY ./package.json yarn.lock /opt/sql-language-server/
5
+ COPY ./packages/server/package.json /opt/sql-language-server/packages/server/
6
+ COPY ./packages/sql-parser/package.json /opt/sql-language-server/packages/sql-parser/
7
+ COPY ./packages/sqlint/package.json /opt/sql-language-server/packages/sqlint/
4
8
WORKDIR /opt/sql-language-server
5
9
RUN yarn
Original file line number Diff line number Diff line change 1
1
<script >
2
- export let name;
3
- // require('./main')
2
+ import { executeFixAllFixableProblemsCommand } from ' ./client'
3
+
4
+ const commands = [
5
+ { id: ' fixAllFixableProblems' , text: ' fixAllFixableProblems' },
6
+ { id: ' switchDatabaseConnection' , text: ' switchDatabaseConnection' },
7
+ ]
8
+
9
+ let command = commands[0 ]
10
+
11
+ function handleSubmitCommand () {
12
+ if (command .id === ' fixAllFixableProblems' ) {
13
+ executeFixAllFixableProblemsCommand ()
14
+ }
15
+ }
4
16
</script >
5
17
6
18
<h1 >Monaco Language Client SQLLanguageServer Sample</h1 >
7
- <div id =" container" style =" width:800px;height:600px;border:1px solid grey" ></div >
8
19
9
- <span >Hell {name }</span >
20
+ <form on:submit |preventDefault ={handleSubmitCommand }>
21
+ <select bind:value ={command }>
22
+ {#each commands as command }
23
+ <option value ={command }>
24
+ {command .text }
25
+ </option >
26
+ {/each }
27
+ </select >
28
+ <button type =submit >Submit</button >
29
+ </form >
30
+
31
+ <div id =" container" style =" width:800px;height:600px;border:1px solid grey" ></div >
Original file line number Diff line number Diff line change 5
5
MonacoLanguageClient ,
6
6
MonacoServices ,
7
7
createConnection ,
8
+ ExecuteCommandParams ,
8
9
} from "monaco-languageclient" ;
9
10
import ReconnectingWebSocket from "reconnecting-websocket" ;
10
11
@@ -36,7 +37,9 @@ export function initClient() {
36
37
listen ( {
37
38
webSocket,
38
39
onConnection : ( connection ) => {
39
- const languageClient = createLanguageClient ( connection ) ;
40
+ languageClient = createLanguageClient ( connection ) ;
41
+ console . log ( '--- languageClient ---' )
42
+ console . log ( languageClient )
40
43
const disposable = languageClient . start ( ) ;
41
44
connection . onClose ( ( ) => disposable . dispose ( ) ) ;
42
45
} ,
@@ -76,3 +79,11 @@ export function initClient() {
76
79
export function getLanguageClient ( ) {
77
80
return languageClient ;
78
81
}
82
+
83
+ export function executeFixAllFixableProblemsCommand ( ) {
84
+ const params : ExecuteCommandParams = {
85
+ command : 'fixAllFixableProblems' ,
86
+ arguments : [ 'inmemory://model.sql' ]
87
+ }
88
+ languageClient . sendRequest ( 'workspace/executeCommand' , params )
89
+ }
You can’t perform that action at this time.
0 commit comments