File tree Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ impl LanguageServer for DjangoLanguageServer {
61
61
client:: log_message ( MessageType :: INFO , "Initializing server..." ) ;
62
62
63
63
self . with_session_mut ( |session| {
64
- * session. client_capabilities_mut ( ) = Some ( params. capabilities ) ;
64
+ session. set_client_capabilities ( params. capabilities ) ;
65
65
} )
66
66
. await ;
67
67
@@ -121,9 +121,11 @@ impl LanguageServer for DjangoLanguageServer {
121
121
self . with_session_mut ( |session| {
122
122
let settings = djls_conf:: Settings :: new ( & project_path)
123
123
. unwrap_or_else ( |_| djls_conf:: Settings :: default ( ) ) ;
124
- * session. settings_mut ( ) = settings;
124
+ session. set_settings ( settings) ;
125
+
126
+ let project = djls_project:: DjangoProject :: new ( project_path) ;
127
+ session. set_project ( project) ;
125
128
126
- * session. project_mut ( ) = Some ( djls_project:: DjangoProject :: new ( project_path) ) ;
127
129
true
128
130
} )
129
131
. await
@@ -298,7 +300,7 @@ impl LanguageServer for DjangoLanguageServer {
298
300
if let Some ( path) = project_path {
299
301
self . with_session_mut ( |session| match djls_conf:: Settings :: new ( path. as_path ( ) ) {
300
302
Ok ( new_settings) => {
301
- * session. settings_mut ( ) = new_settings;
303
+ session. set_settings ( new_settings) ;
302
304
}
303
305
Err ( e) => {
304
306
client:: log_message ( MessageType :: ERROR , format ! ( "Error loading settings: {e}" ) ) ;
Original file line number Diff line number Diff line change @@ -45,8 +45,8 @@ pub struct Session {
45
45
}
46
46
47
47
impl Session {
48
- pub fn client_capabilities_mut ( & mut self ) -> & mut Option < ClientCapabilities > {
49
- & mut self . client_capabilities
48
+ pub fn set_client_capabilities ( & mut self , client_capabilities : ClientCapabilities ) {
49
+ self . client_capabilities = Some ( client_capabilities ) ;
50
50
}
51
51
52
52
pub fn project ( & self ) -> Option < & DjangoProject > {
@@ -56,6 +56,9 @@ impl Session {
56
56
pub fn project_mut ( & mut self ) -> & mut Option < DjangoProject > {
57
57
& mut self . project
58
58
}
59
+ pub fn set_project ( & mut self , project : DjangoProject ) {
60
+ self . project = Some ( project) ;
61
+ }
59
62
60
63
pub fn documents ( & self ) -> & Store {
61
64
& self . documents
@@ -69,8 +72,8 @@ impl Session {
69
72
& self . settings
70
73
}
71
74
72
- pub fn settings_mut ( & mut self ) -> & mut Settings {
73
- & mut self . settings
75
+ pub fn set_settings ( & mut self , settings : Settings ) {
76
+ self . settings = settings ;
74
77
}
75
78
76
79
/// Get a database instance directly from the session
You can’t perform that action at this time.
0 commit comments