Merge pull request #2180 from alixander/nested-layer-ref
d2lsp: fix nested board finding
This commit is contained in:
commit
b2cf9d3647
2 changed files with 13 additions and 3 deletions
|
|
@ -1838,7 +1838,7 @@ func (m *Map) FindBoardRoot(path []string) *Map {
|
||||||
if len(path) == 1 {
|
if len(path) == 1 {
|
||||||
return f.Map()
|
return f.Map()
|
||||||
}
|
}
|
||||||
return layersf.Map().FindBoardRoot(path[1:])
|
return f.Map().FindBoardRoot(path[1:])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1849,7 +1849,7 @@ func (m *Map) FindBoardRoot(path []string) *Map {
|
||||||
if len(path) == 1 {
|
if len(path) == 1 {
|
||||||
return f.Map()
|
return f.Map()
|
||||||
}
|
}
|
||||||
return scenariosf.Map().FindBoardRoot(path[1:])
|
return f.Map().FindBoardRoot(path[1:])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1860,7 +1860,7 @@ func (m *Map) FindBoardRoot(path []string) *Map {
|
||||||
if len(path) == 1 {
|
if len(path) == 1 {
|
||||||
return f.Map()
|
return f.Map()
|
||||||
}
|
}
|
||||||
return stepsf.Map().FindBoardRoot(path[1:])
|
return f.Map().FindBoardRoot(path[1:])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,12 @@ hi
|
||||||
layers: {
|
layers: {
|
||||||
x: {
|
x: {
|
||||||
hello
|
hello
|
||||||
|
|
||||||
|
layers: {
|
||||||
|
y: {
|
||||||
|
qwer
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
|
|
@ -130,6 +136,10 @@ layers: {
|
||||||
assert.Success(t, err)
|
assert.Success(t, err)
|
||||||
assert.Equal(t, 0, len(ranges))
|
assert.Equal(t, 0, len(ranges))
|
||||||
|
|
||||||
|
ranges, _, err = d2lsp.GetRefRanges("index.d2", fs, []string{"x", "y"}, "qwer")
|
||||||
|
assert.Success(t, err)
|
||||||
|
assert.Equal(t, 1, len(ranges))
|
||||||
|
|
||||||
_, _, err = d2lsp.GetRefRanges("index.d2", fs, []string{"y"}, "hello")
|
_, _, err = d2lsp.GetRefRanges("index.d2", fs, []string{"y"}, "hello")
|
||||||
assert.Equal(t, `board "[y]" not found`, err.Error())
|
assert.Equal(t, `board "[y]" not found`, err.Error())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue