forked from vuejs/vetur
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix component data not shown in hover when template interpolation is on
In cases where template interpolation provided some data for the hover popup, it overrode the popup contents without letting component data hover info to show. Ask both services and merge the results together so that nothing is lost. Fixes vuejs#2878
- Loading branch information
Showing
6 changed files
with
76 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { testHover } from '../../../hoverHelper'; | ||
import { position, sameLineRange } from '../../../util'; | ||
import { getDocUri } from '../../path'; | ||
|
||
describe('Should show hover info with component data', () => { | ||
const docUri = getDocUri('hover/Element.vue'); | ||
|
||
it('shows element description', async () => { | ||
await testHover(docUri, position(2, 5), { | ||
contents: [ | ||
'```ts\n(property) __vlsComponentData<Record<string, any>>.props: Record<string, any>\n```\nA foo tag' | ||
], | ||
range: sameLineRange(2, 5, 12) | ||
}); | ||
}); | ||
|
||
it('shows attribute description for non-dynamic attribute', async () => { | ||
await testHover(docUri, position(2, 15), { | ||
contents: ['An foo-attr description'], | ||
range: sameLineRange(2, 13, 21) | ||
}); | ||
}); | ||
|
||
it('shows attribute description for dynamic attribute with template interpolation enabled', async () => { | ||
await testHover(docUri, position(3, 15), { | ||
contents: ['```ts\n(property) "foo-attr": string\n```\nAn foo-attr description'], | ||
range: sameLineRange(3, 14, 22) | ||
}); | ||
}); | ||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"vetur.experimental.templateInterpolationService": true | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
{ | ||
"foo-tag/foo-attr": { | ||
"description": "An foo-attr description" | ||
}, | ||
"handle-foo": { | ||
"type": "event", | ||
"documentation": "You gotta handle foo" | ||
} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<template> | ||
<div> | ||
<foo-tag foo-attr="v" /> | ||
<foo-tag :foo-attr="'v'" /> | ||
</div> | ||
</template> |
This file contains 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