mirror of
https://github.com/turbot/steampipe.git
synced 2025-12-23 21:09:15 -05:00
Rationalise and optimize autocomplete. Closes #3149
This commit is contained in:
@@ -7,9 +7,8 @@ import (
|
||||
)
|
||||
|
||||
type queryCompletionInfo struct {
|
||||
Table string
|
||||
EditingTable bool
|
||||
EditingColumn bool
|
||||
Table string
|
||||
EditingTable bool
|
||||
}
|
||||
|
||||
func getQueryInfo(text string) *queryCompletionInfo {
|
||||
@@ -17,9 +16,8 @@ func getQueryInfo(text string) *queryCompletionInfo {
|
||||
prevWord := getPreviousWord(text)
|
||||
|
||||
return &queryCompletionInfo{
|
||||
Table: table,
|
||||
EditingTable: isEditingTable(prevWord),
|
||||
EditingColumn: isEditingColumn(prevWord, table),
|
||||
Table: table,
|
||||
EditingTable: isEditingTable(prevWord),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,11 +26,6 @@ func isEditingTable(prevWord string) bool {
|
||||
return editingTable
|
||||
}
|
||||
|
||||
func isEditingColumn(prevWord string, table string) bool {
|
||||
var editingColumn = prevWord == "where" || prevWord == "and" || prevWord == "or" && table != ""
|
||||
return editingColumn
|
||||
}
|
||||
|
||||
func getTable(text string) string {
|
||||
// split on space and remove empty results - they occur if there is a double space
|
||||
split := helpers.RemoveFromStringSlice(strings.Split(text, " "), "")
|
||||
|
||||
Reference in New Issue
Block a user