forked from vuejs/vetur
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
22df49c
commit c950555
Showing
6 changed files
with
173 additions
and
0 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,43 @@ | ||
import { testCompletion, testCompletionResolve } from '../../../completionHelper'; | ||
import { position, sameLineRange, textEdit } from '../../../util'; | ||
import { getDocUri } from '../../path'; | ||
|
||
describe('Should import vue component to script in template', () => { | ||
it('completes components', async () => { | ||
await testCompletion(getDocUri('completion/autoImport/defineInOneLine.vue'), position(3, 9), [ | ||
'two-stylus', | ||
'two-stylus-expected' | ||
]); | ||
}); | ||
|
||
/** | ||
* I can't get completion/resolve result in VSCode. =_= | ||
* https://github.com/microsoft/vscode/issues/110182 | ||
*/ | ||
it.skip('Should do auto import when have components define in one line', async () => { | ||
await testCompletionResolve( | ||
getDocUri('completion/autoImport/defineInOneLine.vue'), | ||
position(3, 9), | ||
[ | ||
{ | ||
label: 'two-stylus', | ||
additionalTextEdits: [ | ||
textEdit(sameLineRange(9, 0, 0), "import TwoStylus from '../../formatting/TwoStylus.vue'\n"), | ||
textEdit(sameLineRange(10, 20, 20), ', TwoStylus') | ||
] | ||
}, | ||
{ | ||
label: 'two-stylus-expected', | ||
additionalTextEdits: [ | ||
textEdit( | ||
sameLineRange(9, 0, 0), | ||
"import TwoStylusExpected from '../../formatting/TwoStylus.Expected.vue'\n" | ||
), | ||
textEdit(sameLineRange(10, 20, 20), ', TwoStylusExpected') | ||
] | ||
} | ||
], | ||
2 | ||
); | ||
}); | ||
}); |
23 changes: 23 additions & 0 deletions
23
test/lsp/fixture/completion/autoImport/defineInOneLine.vue
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,23 @@ | ||
<template> | ||
<div> | ||
<child /> | ||
<two- | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import Child from '../template/childComponent/Child.vue' | ||
export default { | ||
components: {Child}, | ||
data () { | ||
return { | ||
foo: '' | ||
} | ||
}, | ||
methods: { | ||
getFoo () { | ||
return this. | ||
} | ||
} | ||
} | ||
</script> |
11 changes: 11 additions & 0 deletions
11
test/lsp/fixture/completion/autoImport/noDefineComponents.vue
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,11 @@ | ||
<template> | ||
<div> | ||
< | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
} | ||
</script> |
17 changes: 17 additions & 0 deletions
17
test/lsp/fixture/completion/autoImport/sameComponentName.vue
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,17 @@ | ||
<template> | ||
<div> | ||
<child /> | ||
< | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import Child from '../template/childComponent/Child.vue' | ||
export default { | ||
components: { | ||
Child, | ||
} | ||
} | ||
</script> |
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