Merge pull request #2170 from alixander/lsp-5

set import ast more precisely
This commit is contained in:
Alexander Wang 2024-10-19 11:19:36 -06:00 committed by GitHub
commit 0bf1823e3f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View file

@ -874,7 +874,7 @@ func (c *compiler) _compileField(f *Field, refctx *RefContext) {
if !ok {
return
}
n.(Importable).SetImportAST(refctx.Key)
n.(Importable).SetImportAST(refctx.Key.Value.Import)
switch n := n.(type) {
case *Field:
if n.Primary_ != nil {

View file

@ -99,6 +99,7 @@ okay
assert.Equal(t, "ok.d2", ranges[0].Path)
assert.Equal(t, 1, len(importRanges))
assert.Equal(t, 3, importRanges[0].Start.Line)
assert.Equal(t, 5, importRanges[0].Start.Column)
ranges, _, err = d2lsp.GetRefRanges("ok.d2", fs, nil, "hi")
assert.Success(t, err)