set import ast more precisely

This commit is contained in:
Alexander Wang 2024-10-19 09:21:32 -06:00
parent 410ae1ca19
commit 65dddcaae6
No known key found for this signature in database
GPG key ID: BE3937D0D52D8927
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)