Append dot after database name when completing on a table#1876
Open
rolandwalker wants to merge 1 commit intomainfrom
Open
Append dot after database name when completing on a table#1876rolandwalker wants to merge 1 commit intomainfrom
rolandwalker wants to merge 1 commit intomainfrom
Conversation
Previously, database names were available as candidates when completing a table name, but if completing a database name, the user had to manually enter a trailing dot before typing a table name. It might be even nicer if the dot was appended after the completion, but did not appear in the candidate menu. It isn't clear how to do that. On the other hand, the dot visually distinguishes which candidates are of which type. The trailing dot does not appear when a database is completed in a database-only position such as USE. There is an xfailed test included, since "USE <database>" is not working correctly under the test suite, but there is related coverage. Instead of checking the entire Document, we look at only the relevant statement using sqlparse.split(), and that fix is applied in a few other places. Otherwise a separate statement can influence completion candidates. The above split logic should also apply to document.text_before_cursor, which is including multiple statements. However, that is beyond the scope of this change. Also, we converge on using "type":"database" instead of "type":"schema" in the completion engine. This somewhat clears up the confusion between "schema" and "database", and more importantly allows database names with a trailing dot to be suggested as completions in "DROP TABLE".
fc87caf to
5a52b84
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Previously, database names were available as candidates when completing a table name, but if completing a database name, the user had to manually enter a trailing dot before typing a table name.
It might be even nicer if the dot was appended after the completion, but did not appear in the candidate menu. It isn't clear how to do that. On the other hand, the dot visually distinguishes which candidates are of which type.
The trailing dot does not appear when a database is completed in a database-only position such as
USE.There is an xfailed test included, since
USE <database>is not working correctly under the test suite, but there is related coverage.Instead of checking the entire
Document, we look at only the relevant statement usingsqlparse.split(), and that fix is applied in a few other places. Otherwise a separate statement can influence completion candidates.The above split logic should also apply to
document.text_before_cursor, which is including multiple statements. However, that is beyond the scope of this change.Also, we converge on using
"type":"database"instead of"type":"schema"in the completion engine. This somewhat clears up the confusion between "schema" and "database", and more importantly allows database names with a trailing dot to be suggested as completions inDROP TABLE.Checklist
changelog.mdfile.AUTHORSfile (or it's already there).