File tree Expand file tree Collapse file tree 1 file changed +18
-9
lines changed Expand file tree Collapse file tree 1 file changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,23 @@ export async function activateLsp(context: ExtensionContext) {
8181 return
8282 }
8383
84+ setupClient ( )
85+
86+ // Automatically start the client only if we can find a config file
87+ if (
88+ ( await fileExists ( 'sgconfig.yml' ) ) ||
89+ ( await fileExists ( 'sgconfig.yaml' ) )
90+ ) {
91+ // Start the client. This will also launch the server
92+ client . start ( )
93+ } else {
94+ client . outputChannel . appendLine (
95+ 'no project file sgconfig.yml found in root. Skip starting LSP.' ,
96+ )
97+ }
98+ }
99+
100+ function setupClient ( ) {
84101 // instantiate and set input which updates the view
85102 // If the extension is launched in debug mode then the debug server options are used
86103 // Otherwise the run options are used
@@ -104,20 +121,12 @@ export async function activateLsp(context: ExtensionContext) {
104121 serverOptions ,
105122 clientOptions ,
106123 )
107-
108- // Automatically start the client only if we can find a config file
109- if (
110- ( await fileExists ( 'sgconfig.yml' ) ) ||
111- ( await fileExists ( 'sgconfig.yaml' ) )
112- ) {
113- // Start the client. This will also launch the server
114- client . start ( )
115- }
116124}
117125
118126async function restart ( ) : Promise < void > {
119127 await deactivate ( )
120128 if ( client ) {
129+ setupClient ( )
121130 await client . start ( )
122131 }
123132}
You can’t perform that action at this time.
0 commit comments