Skip to content

Commit 0e30631

Browse files
committed
Fix global find
1 parent db51b1b commit 0e30631

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

crates/code_analysis/src/compilation/analyzer/decl/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,11 @@ fn walk_node_enter(analyzer: &mut DeclAnalyzer, node: LuaAst) {
3838
analyzer.create_scope(block.get_range(), LuaScopeKind::Normal);
3939
}
4040
LuaAst::LuaLocalStat(stat) => {
41-
analyzer.create_scope(stat.get_range(), LuaScopeKind::LocalStat);
41+
analyzer.create_scope(stat.get_range(), LuaScopeKind::LocalOrAssignStat);
4242
stats::analyze_local_stat(analyzer, stat);
4343
}
4444
LuaAst::LuaAssignStat(stat) => {
45+
analyzer.create_scope(stat.get_range(), LuaScopeKind::LocalOrAssignStat);
4546
stats::analyze_assign_stat(analyzer, stat);
4647
}
4748
LuaAst::LuaForStat(stat) => {
@@ -117,7 +118,8 @@ fn is_scope_owner(node: &LuaAst) -> bool {
117118
| LuaSyntaxKind::ForStat
118119
| LuaSyntaxKind::LocalStat
119120
| LuaSyntaxKind::FuncStat
120-
| LuaSyntaxKind::LocalFuncStat => true,
121+
| LuaSyntaxKind::LocalFuncStat
122+
| LuaSyntaxKind::AssignStat => true,
121123
_ => false,
122124
}
123125
}

crates/code_analysis/src/db_index/declaration/decl_tree.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ impl LuaDeclarationTree {
136136
F: FnMut(ScopeOrDeclId) -> bool,
137137
{
138138
match scope.get_kind() {
139-
LuaScopeKind::LocalStat => {
139+
LuaScopeKind::LocalOrAssignStat => {
140140
let parent = scope.get_parent();
141141
if let Some(parent) = parent {
142142
let parent_scope = self.scopes.get(parent.id as usize).unwrap();
@@ -176,7 +176,7 @@ impl LuaDeclarationTree {
176176
F: FnMut(ScopeOrDeclId) -> bool,
177177
{
178178
match scope.get_kind() {
179-
LuaScopeKind::LocalStat | LuaScopeKind::FuncStat => {
179+
LuaScopeKind::LocalOrAssignStat | LuaScopeKind::FuncStat => {
180180
for child in scope.get_children() {
181181
if let ScopeOrDeclId::Decl(decl_id) = child {
182182
if f(decl_id.into()) {

crates/code_analysis/src/db_index/declaration/scope.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use super::decl::LuaDeclId;
88
pub enum LuaScopeKind {
99
Normal,
1010
Repeat,
11-
LocalStat,
11+
LocalOrAssignStat,
1212
ForRange,
1313
FuncStat
1414
}

crates/emmylua_ls/src/handlers/initialized/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ mod collect_files;
44
mod locale;
55
mod regsiter_file_watch;
66

7-
use std::{collections::HashMap, path::PathBuf, str::FromStr, sync::Arc};
7+
use std::{path::PathBuf, str::FromStr, sync::Arc};
88

99
use crate::{
1010
cmd_args::CmdArgs,

0 commit comments

Comments
 (0)