Skip to content

Commit ceba17c

Browse files
committed
[FIX] server: improve message for missing dependency on inherit
1 parent f53de9f commit ceba17c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

server/features/validation/python_validator.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,13 +310,19 @@ def validate_structure(self):
310310
severity = 1
311311
))
312312
elif not inherited_models:
313+
model_syms = model.get_main_symbols()
314+
models = []
315+
for model_sym in model_syms:
316+
models.append(model_sym.get_module_sym())
317+
models = ", ".join([model.name for model in models])
318+
models = " or ".join(models.rsplit(", ", 1))
313319
self.diagnostics.append(Diagnostic(
314320
range = Range(
315321
start=Position(line=position[0][0]-1, character=position[0][1]),
316322
end=Position(line=position[0][0]-1, character=1) if sys.version_info < (3, 8) else \
317323
Position(line=position[0][0]-1, character=position[1][0])
318324
),
319-
message = inherit + " does not exist",
325+
message = inherit + " is not in your dependencies. Please review the dependencies of your module to add " + models + " in it",
320326
source = EXTENSION_NAME,
321327
severity = 1
322328
))

0 commit comments

Comments
 (0)