feat: external model takes you to the model not just file#4711
Merged
feat: external model takes you to the model not just file#4711
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
Adds support for navigating to external model definitions in YAML files by introducing a new reference type and extracting the exact block range.
- Introduce
LSPExternalModelReferenceand extend the reference schema and union - Implement
_get_yaml_model_rangeto locate model blocks within external YAML files - Update
goto_definitionto handle external modeltarget_rangeand add a new test
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/lsp/test_reference_external_model.py | Adds a test for external model reference navigation |
| sqlmesh/lsp/reference.py | Defines LSPExternalModelReference, extends the reference union, and adds YAML range extraction logic |
| sqlmesh/lsp/main.py | Updates goto_definition to correctly handle external model target_range |
| sqlmesh/lsp/helpers.py | Adds to_sqlmesh_range helper for converting LSP ranges to SQLMesh ranges |
Comments suppressed due to low confidence (3)
sqlmesh/lsp/reference.py:743
- The docstring refers to
yaml_pathbut the function parameter is namedpath. Update the doc to match the parameter name for consistency.
yaml_path: Path to the YAML file
tests/lsp/test_reference_external_model.py:33
- This test only covers the successful path where
target_rangeis present. Add tests for the fallback path whentarget_rangeis None and for invalid YAML structures to ensure robust coverage.
if reference.target_range is None:
sqlmesh/lsp/helpers.py:9
- There are no unit tests for
to_sqlmesh_range. Add tests to verify correct conversion between LSPRangeandSQLMeshRange.
def to_sqlmesh_range(
6dbc589 to
1b5a003
Compare
themisvaltinos
approved these changes
Jun 11, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.