Conversation
package.json
Outdated
| { | ||
| "command": "mysql.searchTable", | ||
| "title": "Search Table", | ||
| "icon": { |
There was a problem hiding this comment.
Where do you use the icon?
package.json
Outdated
| "category": "MySQL" | ||
| }, | ||
| { | ||
| "command": "mysql.searchTable", |
There was a problem hiding this comment.
The function is more like filter not search
src/common/global.ts
Outdated
| } | ||
|
|
||
| public static tableFilter(tables: any[]) { | ||
| if ( Global.keyword ) { |
There was a problem hiding this comment.
The filter should only take place on a certain database not global.
src/mysqlTreeDataProvider.ts
Outdated
|
|
||
| public async searchTable() { | ||
| Global.keyword = await vscode.window.showInputBox({ prompt: "" , placeHolder: "table", value: Global.keyword }); | ||
| this.refresh(); |
There was a problem hiding this comment.
refresh should only take place on a certain database not global.
formulahendry
left a comment
There was a problem hiding this comment.
Please also rebase with the master branch
package.json
Outdated
| }, | ||
| { | ||
| "command": "mysql.keywordFilter", | ||
| "title": "Keyword Filter", |
There was a problem hiding this comment.
Better naming? Just call it Filter?
package.json
Outdated
| "group": "mysql@1" | ||
| }, | ||
| { | ||
| "command": "mysql.keywordFilter", |
There was a problem hiding this comment.
Put this after mysql.deleteConnection
package.json
Outdated
| { | ||
| "command": "mysql.keywordFilter", | ||
| "when": "view == mysql && viewItem == connection", | ||
| "group": "mysql@2" |
package.json
Outdated
| "group": "mysql@2" | ||
| }, | ||
| { | ||
| "command": "mysql.keywordFilter", |
There was a problem hiding this comment.
Put it after
{
"command": "mysql.refresh",
"when": "view == mysql && viewItem == database",
"group": "mysql@1"
}| import { INode } from "./INode"; | ||
|
|
||
| export class ConnectionNode implements INode { | ||
| public keyword; |
There was a problem hiding this comment.
Leave a blank line after this
| import { TableNode } from "./tableNode"; | ||
|
|
||
| export class DatabaseNode implements INode { | ||
| public keyword; |
There was a problem hiding this comment.
Leave a blank line after this
src/model/connectionNode.ts
Outdated
|
|
||
| return Utility.queryPromise<any[]>(connection, "SHOW DATABASES") | ||
| .then((databases) => { | ||
| if ( this.keyword ) { |
There was a problem hiding this comment.
No extra space inside parentheses
src/model/connectionNode.ts
Outdated
| .then((databases) => { | ||
| if ( this.keyword ) { | ||
| databases = databases.filter((table) => { | ||
| return table.Database.indexOf( this.keyword ) !== -1; |
There was a problem hiding this comment.
Same here: No extra space inside parentheses
| public async keywordFilter(node: DatabaseNode | ConnectionNode) { | ||
| vscode.window.showInputBox({ | ||
| prompt: "" , placeHolder: "keyword", value: node.keyword, | ||
| validateInput: (keyword: string) => { |
There was a problem hiding this comment.
It this by design? It will trigger this.refresh(node) every time user input or delete a character. For the better practice, it should be only trigger when user press Enter
src/model/connectionNode.ts
Outdated
| return Utility.queryPromise<any[]>(connection, "SHOW DATABASES") | ||
| .then((databases) => { | ||
| if ( this.keyword ) { | ||
| databases = databases.filter((table) => { |
src/model/databaseNode.ts
Outdated
| @@ -36,6 +38,11 @@ export class DatabaseNode implements INode { | |||
|
|
|||
| return Utility.queryPromise<any[]>(connection, `SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = '${this.database}' LIMIT ${Utility.maxTableCount}`) | |||
There was a problem hiding this comment.
If this.keyword is set, how about updating the SQL to add TABLE_NAME like '%this.keyword%'? In case there are over thousands of tables in a database.
| }); | ||
|
|
||
| return Utility.queryPromise<any[]>(connection, `SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = '${this.database}' LIMIT ${Utility.maxTableCount}`) | ||
| const filter = this.keyword ? `TABLE_NAME LIKE '%${this.keyword}%'` : ""; |
| }); | ||
|
|
||
| return Utility.queryPromise<any[]>(connection, "SHOW DATABASES") | ||
| return Utility.queryPromise<any[]>(connection, "SHOW DATABASES" + (this.keyword ? ` LIKE '%${this.keyword}%'` : "")) |
formulahendry
left a comment
There was a problem hiding this comment.
Please also resolve https://github.com/formulahendry/vscode-mysql/pull/12/files#r159821601

有木有搜索图标可以用一下 ?现在的图标不太合适【
】