Skip to content

Conversation

@laoshaw
Copy link

@laoshaw laoshaw commented Aug 18, 2019

Description

Added keywords and json functions from mysql 5.7 and 8.0 for auto-completion

Checklist

  • I've added this contribution to the changelog.md. -- not seen this file
  • I've added my name to the AUTHORS file (or it's already there). -- change too small to be added

@tsroten
Copy link
Member

tsroten commented Aug 25, 2019

@laoshaw Thanks for this pull request! We really appreciate this. I'm going to leave a few comments on this for some things that might need updating.

'USING', 'VALUES', 'VARCHAR', 'VIEW', 'WHEN', 'WHERE', 'WITH',
'JSON', 'ISNULL', 'GREATEST', 'LEAST', 'BLOB', 'BIT', 'OPAQUE',
'DATETIME', 'BOOLEAN', 'ARRAY', 'OBJECT', 'STRING', 'DOUBLE', 'NULL',
'ENUM', 'TEXT']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move ISNULL, GREATEST, and LEAST down to the function list?

'JSON_MERGE_PATCH', 'JSON_MERGE_PRESERVE', 'JSON_OBJECT', 'JSON_PRETTY',
'JSON_QUOTE', 'JSON_REMOVE', 'JSON_REPLACE', 'JSON_SEARCH', 'JSON_SET',
'JSON_STORAGE_SIZE', 'JSON_TYPE', 'JSON_UNQUOTE', 'JSON_VALID',
'JSON_ARRAYAVG', 'JSON_OBJECTAVG', 'JSON_OVERLAPS', 'JSON_SCHEMA_VALID',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean JSON_ARRAYAGG and JSON_OBJECTAGG?

'JSON_STORAGE_SIZE', 'JSON_TYPE', 'JSON_UNQUOTE', 'JSON_VALID',
'JSON_ARRAYAVG', 'JSON_OBJECTAVG', 'JSON_OVERLAPS', 'JSON_SCHEMA_VALID',
'JSON_SCHEMA_VALIDATION_REPORT', 'JSON_STORAGE_FREE', 'JSON_TABLE',
'MEMBER_OF']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MEMBER_OF() looks like it should be two words (MEMBER OF()).

@tsroten
Copy link
Member

tsroten commented Aug 25, 2019

Also, do you think we could put the new suggestions in alphabetical order with the old ones? It definitely makes it easier for developers to find things in the list when we need to make changes, etc.

@amjith
Copy link
Member

amjith commented Apr 19, 2020

@laoshaw Are you still interested in addressing the comments that @tsroten left?

If so, please let us know. I'll keep this PR open for a couple more days.

@laoshaw
Copy link
Author

laoshaw commented Apr 19, 2020

yes I think the new one is better.

@amjith
Copy link
Member

amjith commented Apr 19, 2020

yes I think the new one is better.

I don't understand. Are you saying that you'll create a new PR or will you add more commits to this PR?

@gfrlv
Copy link
Member

gfrlv commented Jan 17, 2021

Closing this, since it has not been updated since April, and now there is another take in #925
@laoshaw feel free to open a new PR if you still want to work on the issue

@gfrlv gfrlv closed this Jan 17, 2021
rolandwalker added a commit that referenced this pull request Jan 19, 2026
Since the pygments library is already required, why not use its list of
reserved words for completions?

This fixes #767 and should keep us up-to-date. It's really great to have
the JSON_* functions.

Obsoletes #925.

Compared to the previous code, this PR

 * removes LEN and TOP, which are not MySQL reserved words
 * preserves extra completion candidates containing space, such as
   "ORDER BY"

Downsides and bugs:

* pygments.lexers._mysql_builtins does contain a leading underscore, so
  we should be aware that the library reserves the right to break this
  usage. The library version has been more tightly defined to remediate
  issues here.
* Similarly, certain tests might become more brittle with regard to
  library updates.
* Certain reserved words are duplicated with special commands, so if
  the first word of a command-line is any of the following, duplicated
  completions will show, as both upper- and lower-case: exit, help,
  source, status, system, use. This is fixable, but should we prefer
  the upper- or lower-case flavor?
* There are _many_ more completion candidates now, which may inspire us
  to do further work soon on prioritizing which completions are seen at
  the top.
rolandwalker added a commit that referenced this pull request Jan 19, 2026
Since the pygments library is already required, why not use its list of
reserved words for completions?

This fixes #767 and should keep us up-to-date. It's really great to have
the JSON_* functions.

Obsoletes #925.

Compared to the previous code, this PR

 * removes LEN and TOP, which are not MySQL reserved words
 * preserves extra completion candidates containing space, such as
   "ORDER BY"

Downsides and bugs:

* pygments.lexers._mysql_builtins does contain a leading underscore, so
  we should be aware that the library reserves the right to break this
  usage. The library version has been more tightly defined to remediate
  issues here.
* Similarly, certain tests might become more brittle with regard to
  library updates.
* Certain reserved words are duplicated with special commands, so if
  the first word of a command-line is any of the following, duplicated
  completions will show, as both upper- and lower-case: exit, help,
  source, status, system, use. This is fixable, but should we prefer
  the upper- or lower-case flavor?
* There are _many_ more completion candidates now, which may inspire us
  to do further work soon on prioritizing which completions are seen at
  the top.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants