We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
monaco-sql-languages 支持的 language 都是各种 SQL,与之对应的就会有许多符号/icon是SQL语言特有的,比如 database 、table 等,而monaco 内置并不支持这些符号/icon,目前自动补全项左侧的 icon 问题尤为明显:
与monaco/vscode 的字体图标风格保持一致 https://code.visualstudio.com/api/references/icons-in-labels#icon-listing
自动补全项左侧会根据不同的自动补全项的 CompletionItemKind 属性显示不同的 icon,但是内置的类型并不能覆盖所有的 SQL 补全项类型,比如 table、database 等,所以需要一个类型映射
CompletionItemKind
同时,monaco-sql-languages 需要新增公开的辅助方法,用于将 dt-sql-parser 中的 实体类型(EntityContextType/ SyntaxContextType )转换为 CompletionItemKind
EntityContextType
SyntaxContextType
import { SyntaxContextType } from 'dt-sql-parser'; import { languages } from 'monaco-editor/esm/vs/editor/editor.api'; export function toCompletionItemKind(type: SyntaxContextType): languages.CompletionItemKind { switch(type) { case SyntaxContextType.CATALOG: return languages.CompletionItemKind.Folder; case SyntaxContextType.DATABASE: return languages.CompletionItemKind.File; // ... default: return languages.CompletionItemKind.Text; } }
每一种类型对应的icon 类名格式为: .codicon-${built-in-icon-name}
.codicon-${built-in-icon-name}
内置的 icon 名称看这里: https://code.visualstudio.com/api/references/icons-in-labels#icon-listing
自动补全项的icon名称都是以 symbol- 为前缀的
symbol-
.codicon-symbol-text:before { content: '\eb01'; } .codicon-symbol-function:before { content: '\eb02'; } .codicon-symbol-folder:before { content: '\eb03'; } .codicon-symbol-field:before { content: '\eb04'; }
The text was updated successfully, but these errors were encountered:
@HaydenOrz 你好,我想提示column的信息,需要获取table的名称,要如何获取啊
Sorry, something went wrong.
与本 issue 无关,已新建issue #107
@dcycurry 有更多问题,请在新的issue 下评论
css覆盖使用svg可以先将content内容清空,再用background设置即可。比如:
.codicon-symbol-file:before { content: '' !important; width: 16px; height: 16px; background: url('../assets/svg/database.svg') no-repeat 0 0/16px 16px; } .codicon-symbol-class:before { content: '' !important; width: 16px; height: 16px; background: url('../assets/svg/table.svg') no-repeat 0 0/16px 16px; } .codicon-symbol-field:before { content: '' !important; width: 16px; height: 16px; background: url('../assets/svg/column.svg') no-repeat 0 0/16px 16px; }
No branches or pull requests
Why?
monaco-sql-languages 支持的 language 都是各种 SQL,与之对应的就会有许多符号/icon是SQL语言特有的,比如 database 、table 等,而monaco 内置并不支持这些符号/icon,目前自动补全项左侧的 icon 问题尤为明显:
方案概述
字体图标风格
与monaco/vscode 的字体图标风格保持一致 https://code.visualstudio.com/api/references/icons-in-labels#icon-listing
字体图标表
SQL 补全项类型与 monaco 内置的 CompletionItemKind 映射表
自动补全项左侧会根据不同的自动补全项的
CompletionItemKind
属性显示不同的 icon,但是内置的类型并不能覆盖所有的 SQL 补全项类型,比如 table、database 等,所以需要一个类型映射同时,monaco-sql-languages 需要新增公开的辅助方法,用于将 dt-sql-parser 中的 实体类型(
EntityContextType
/SyntaxContextType
)转换为CompletionItemKind
覆盖 icon 的 css 文件参考
每一种类型对应的icon 类名格式为:
.codicon-${built-in-icon-name}
内置的 icon 名称看这里: https://code.visualstudio.com/api/references/icons-in-labels#icon-listing
自动补全项的icon名称都是以
symbol-
为前缀的The text was updated successfully, but these errors were encountered: