11
11
from typing import Pattern
12
12
13
13
# Local modules
14
+ from fortls ._version import __version__
14
15
from fortls .constants import (
15
16
CLASS_TYPE_ID ,
16
17
FORTRAN_LITERAL ,
21
22
SELECT_TYPE_ID ,
22
23
SUBROUTINE_TYPE_ID ,
23
24
VAR_TYPE_ID ,
25
+ log ,
24
26
)
25
27
from fortls .helper_functions import (
26
28
expand_name ,
55
57
src_file_exts ,
56
58
)
57
59
58
- log = logging .getLogger (__name__ )
59
60
# Global regexes
60
61
# TODO: I think this can be replaced by fortls.regex_patterns type & class
61
62
TYPE_DEF_REGEX = re .compile (r"[ ]*(TYPE|CLASS)[ ]*\([a-z0-9_ ]*$" , re .I )
@@ -179,6 +180,7 @@ def noop(request):
179
180
"workspace/didChangeWatchedFiles" : noop ,
180
181
"workspace/symbol" : self .serve_workspace_symbol ,
181
182
"$/cancelRequest" : noop ,
183
+ "$/setTrace" : noop ,
182
184
"shutdown" : noop ,
183
185
"exit" : self .serve_exit ,
184
186
}.get (request ["method" ], self .serve_default )
@@ -190,7 +192,7 @@ def noop(request):
190
192
try :
191
193
handler (request )
192
194
except :
193
- log .warning ("error handling notification %s" , request , exc_info = True )
195
+ log .exception ("error handling request: %s" , request , exc_info = True )
194
196
return
195
197
#
196
198
try :
@@ -220,6 +222,11 @@ def serve_initialize(self, request):
220
222
params .get ("rootUri" ) or params .get ("rootPath" ) or ""
221
223
)
222
224
self .source_dirs .add (self .root_path )
225
+ logging .basicConfig (
226
+ format = "[%(levelname)-.4s - %(asctime)s] %(message)s" ,
227
+ datefmt = "%H:%M:%S" ,
228
+ level = logging .INFO ,
229
+ )
223
230
self .__config_logger (request )
224
231
init_debug_log = self .__load_config_file ()
225
232
if init_debug_log :
@@ -229,6 +236,7 @@ def serve_initialize(self, request):
229
236
230
237
# Initialize workspace
231
238
self .workspace_init ()
239
+ log .info (f"fortls - Fortran Language Server v{ __version__ } Initialized" )
232
240
#
233
241
server_capabilities = {
234
242
"completionProvider" : {
@@ -251,7 +259,7 @@ def serve_initialize(self, request):
251
259
if self .enable_code_actions :
252
260
server_capabilities ["codeActionProvider" ] = True
253
261
if self .notify_init :
254
- self .post_messages .append ([3 , "FORTLS initialization complete" ])
262
+ self .post_messages .append ([3 , "fortls initialization complete" ])
255
263
return {"capabilities" : server_capabilities }
256
264
257
265
def serve_workspace_symbol (self , request ):
0 commit comments