set import ast more precisely
This commit is contained in:
parent
410ae1ca19
commit
65dddcaae6
2 changed files with 2 additions and 1 deletions
|
|
@ -874,7 +874,7 @@ func (c *compiler) _compileField(f *Field, refctx *RefContext) {
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
n.(Importable).SetImportAST(refctx.Key)
|
n.(Importable).SetImportAST(refctx.Key.Value.Import)
|
||||||
switch n := n.(type) {
|
switch n := n.(type) {
|
||||||
case *Field:
|
case *Field:
|
||||||
if n.Primary_ != nil {
|
if n.Primary_ != nil {
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,7 @@ okay
|
||||||
assert.Equal(t, "ok.d2", ranges[0].Path)
|
assert.Equal(t, "ok.d2", ranges[0].Path)
|
||||||
assert.Equal(t, 1, len(importRanges))
|
assert.Equal(t, 1, len(importRanges))
|
||||||
assert.Equal(t, 3, importRanges[0].Start.Line)
|
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")
|
ranges, _, err = d2lsp.GetRefRanges("ok.d2", fs, nil, "hi")
|
||||||
assert.Success(t, err)
|
assert.Success(t, err)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue