Closed ffbh123456 closed 3 years ago
We do not run busted in vscode nor was it designed to support code completion in vscode. Pull requests are welcome!
Hi, @DorianGray I wrote a simple vscode code snippet, which can quickly generate busted unit test related code, if you need it, I will push a Pull request
{
"assert.is_true": {
"prefix": "assert.is_true",
"body": [
"assert.is_true($1);"
],
"description": "busted assert"
},
"assert.is_not_true": {
"prefix": "assert.is_not_true",
"body": [
"assert.is_not_true($1);"
],
"description": "busted assert"
},
"assert.is.equal": {
"prefix": "assert.is.equal",
"body": [
"assert.is.equal($1);"
],
"description": "busted assert"
},
"assert.is.truthy": {
"prefix": "assert.is.truthy",
"body": [
"assert.is.truthy($1);"
],
"description": "busted assert"
},
"assert.is.falsy": {
"prefix": "assert.is.falsy",
"body": [
"assert.is.falsy($1);"
],
"description": "busted assert"
},
"assert.is_not.equal": {
"prefix": "assert.is_not.equal",
"body": [
"assert.is_not.equal($1);"
],
"description": "busted assert"
},
"assert.is.errors": {
"prefix": "assert.is.errors",
"body": [
"assert.is.errors(",
"\tfunction()",
"\t\t$1",
"\tend",
")"
],
"description": "busted assert"
},
"assert.is_not.errors": {
"prefix": "assert.is_not.errors",
"body": [
"assert.is_not.errors(",
"\tfunction()",
"\t\t$1",
"\tend",
")"
],
"description": "busted assert"
},
"test": {
"prefix": "test",
"body": [
"test(",
"\t\"$1\",",
"\tfunction()",
"\t\t",
"\tend",
")"
],
"description": "busted assert"
},
"describe": {
"prefix": "describe",
"body": [
"describe(",
"\t\"$1\",",
"\tfunction()",
"\t\t",
"\tend",
")"
],
"description": "busted assert"
}
}
These functions actually come from the luassert project. I think the correct way to get completion in your editor is to tel your code scanner to look for function definitions in that project's code as well as busted & your own local project.
I do not think code libraries should be responsible for creating completion routines for any editor, VScode or otherwise. The list would never end, and some have many different formats they would want the data in depending on the plugin you used. This should be generated by the editor/plugin somewhere feeding it the code libraries being used.
OK, I will try it later
There is no code hint when writing assets test, is there any good way? For example, when I input assert.a, I hope vscode can prompt me the words are, are_not