mirror of
https://github.com/esphome/esphome.git
synced 2025-09-16 10:12:21 +01:00
Add config validator location (#1490)
* show validation source location for id * show validation source location for lambda * refactor lambda #line position * account content offset on made lambdas * lint * remove redundant check
This commit is contained in:
committed by
GitHub
parent
de3377132d
commit
28e39f7f76
@@ -268,6 +268,8 @@ class Config(OrderedDict):
|
||||
data = data[item_index]
|
||||
except (KeyError, IndexError, TypeError):
|
||||
return doc_range
|
||||
if isinstance(data, core.ID):
|
||||
data = data.id
|
||||
if isinstance(data, ESPHomeDataBase) and data.esp_range is not None:
|
||||
doc_range = data.esp_range
|
||||
|
||||
@@ -700,6 +702,8 @@ def line_info(obj, highlight=True):
|
||||
"""Display line config source."""
|
||||
if not highlight:
|
||||
return None
|
||||
if isinstance(obj, core.ID):
|
||||
obj = obj.id
|
||||
if isinstance(obj, ESPHomeDataBase) and obj.esp_range is not None:
|
||||
mark = obj.esp_range.start_mark
|
||||
source = "[source {}:{}]".format(mark.document, mark.line + 1)
|
||||
|
Reference in New Issue
Block a user