Skip to content

Commit f7a51cb

Browse files
authored
fix: improve compiler detection and prevent crash when missing (fix #154) (#175)
1 parent ec9e97d commit f7a51cb

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

src/analyzer/IndexingManager.v

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ pub fn IndexingManager.new() &IndexingManager {
1515
}
1616
}
1717

18+
pub fn (mut a IndexingManager) setup_empty_indexes() {
19+
a.stub_index = psi.new_stubs_index([])
20+
stubs_index = a.stub_index
21+
}
22+
1823
pub fn (mut a IndexingManager) setup_stub_indexes() {
1924
mut sinks := a.all_sinks()
2025
a.stub_index = psi.new_stubs_index(sinks)

src/project/flavors/SymlinkToolchainFlavor.v

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ import os
55
pub struct SymlinkToolchainFlavor {}
66

77
fn (s &SymlinkToolchainFlavor) get_home_page_candidates() []string {
8-
symlink_path_candidates := ['/usr/local/bin/v', '${os.home_dir()}/.local/bin/v']
8+
symlink_path_candidates := [
9+
'/usr/bin/v',
10+
'/usr/local/bin/v',
11+
'${os.home_dir()}/.local/bin/v',
12+
]
913

1014
mut result := []string{}
1115

src/server/general.v

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ pub fn (mut ls LanguageServer) initialize(params lsp.InitializeParams, mut wr Re
9797

9898
pub fn (mut ls LanguageServer) initialized(mut wr ResponseWriter) {
9999
loglib.info('-------- New session -------- ')
100+
ls.indexing_mng.setup_empty_indexes()
101+
100102
if ls.paths.vexe == '' || ls.paths.vlib_root == '' {
101103
ls.client.send_server_status(health: 'error', quiescent: true)
102104
return

0 commit comments

Comments
 (0)