Skip to content

Commit fa43912

Browse files
authored
fix(lsp): fail gently on scope building failure (#4576)
1 parent 1fb40ee commit fa43912

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

sqlmesh/lsp/reference.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,12 @@ def get_model_definitions_for_a_path(
134134
with open(file_path, "r", encoding="utf-8") as file:
135135
read_file = file.readlines()
136136

137-
# Build scope tree to properly handle nested CTEs
138-
query = normalize_identifiers(query.copy(), dialect=dialect)
139-
root_scope = build_scope(query)
137+
# Build a scope tree to properly handle nested CTEs
138+
try:
139+
query = normalize_identifiers(query.copy(), dialect=dialect)
140+
root_scope = build_scope(query)
141+
except Exception:
142+
root_scope = None
140143

141144
if root_scope:
142145
# Traverse all scopes to find CTE definitions and table references

0 commit comments

Comments
 (0)