-
Notifications
You must be signed in to change notification settings - Fork 49
feat: support hover provider feat #194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Conversation
| allEntities.find( | ||
| (en): en is CommonEntityContext => | ||
| en.entityContextType === EntityContextType.TABLE_CREATE && en.text === tableName | ||
| ) ?? null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
考虑实体一边加反引号,一边没加的情况应该也匹配上
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这种情况我调试一下看看
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
加了加了
| p.endColumn >= position.column && | ||
| p.line === position.lineNumber | ||
| ); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
当hover在表别名上时,也可以查找到的,展示的时候可以把表和别名一起展示
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
确实,我加一下
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
加了
功能
支持
HoverProvider的开发描述
在我们dt-sql-parser内部,
CommonEntityContext实体被收集的时候,区分了是新建还是使用,如果是新建的情况下,会从当前CREATE语句中捞到columns挂在当前实体上,而我们当前功能就是当用户使用通过SQL新建出来的表时,使用表的地方hover到表名上方,可以展示出对应的字段列表,字段列表里包含字段名以及字段类型。preview
https://cythia828.github.io/monaco-sql-languages/
自测
demo
CREATE TABLE postgresql.public.employees ( emp_id BIGINT COMMENT 'sfsf', name VARCHAR, department VARCHAR ) WITH ( connector = 'postgresql', connection_url = 'jdbc:postgresql://localhost:5432/company', connection_user = 'user', connection_password = 'password' ); select emp_id from postgresql.public.employees as tb1 select id from "postgresql.public.employees" select name from 'postgresql.public.employees' select name frompostgresql.public.employees``