♻️ Refactor search
This commit is contained in:
@@ -15,16 +15,19 @@ type ExtensionID string
|
||||
|
||||
const (
|
||||
// 编辑增强扩展
|
||||
ExtensionRainbowBrackets ExtensionID = "rainbowBrackets" // 彩虹括号
|
||||
ExtensionHyperlink ExtensionID = "hyperlink" // 超链接
|
||||
ExtensionColorSelector ExtensionID = "colorSelector" // 颜色选择器
|
||||
ExtensionFold ExtensionID = "fold"
|
||||
ExtensionTextHighlight ExtensionID = "textHighlight"
|
||||
ExtensionCheckbox ExtensionID = "checkbox" // 选择框
|
||||
ExtensionTranslator ExtensionID = "translator" // 划词翻译
|
||||
ExtensionRainbowBrackets ExtensionID = "rainbowBrackets" // 彩虹括号
|
||||
ExtensionHyperlink ExtensionID = "hyperlink" // 超链接
|
||||
ExtensionColorSelector ExtensionID = "colorSelector" // 颜色选择器
|
||||
ExtensionFold ExtensionID = "fold" // 代码折叠
|
||||
ExtensionTranslator ExtensionID = "translator" // 划词翻译
|
||||
ExtensionMarkdown ExtensionID = "markdown" // Markdown渲染
|
||||
ExtensionHighlightWhitespace ExtensionID = "highlightWhitespace" // 显示空白字符
|
||||
ExtensionHighlightTrailingWhitespace ExtensionID = "highlightTrailingWhitespace" // 高亮行尾空白
|
||||
|
||||
// UI增强扩展
|
||||
ExtensionMinimap ExtensionID = "minimap" // 小地图
|
||||
ExtensionMinimap ExtensionID = "minimap" // 小地图
|
||||
ExtensionLineNumbers ExtensionID = "lineNumbers" // 行号显示
|
||||
ExtensionContextMenu ExtensionID = "contextMenu" // 上下文菜单
|
||||
|
||||
// 工具扩展
|
||||
ExtensionSearch ExtensionID = "search" // 搜索功能
|
||||
@@ -87,21 +90,6 @@ func NewDefaultExtensions() []Extension {
|
||||
IsDefault: true,
|
||||
Config: ExtensionConfig{},
|
||||
},
|
||||
{
|
||||
ID: ExtensionTextHighlight,
|
||||
Enabled: true,
|
||||
IsDefault: true,
|
||||
Config: ExtensionConfig{
|
||||
"backgroundColor": "#FFD700",
|
||||
"opacity": 0.3,
|
||||
},
|
||||
},
|
||||
{
|
||||
ID: ExtensionCheckbox,
|
||||
Enabled: true,
|
||||
IsDefault: true,
|
||||
Config: ExtensionConfig{},
|
||||
},
|
||||
{
|
||||
ID: ExtensionTranslator,
|
||||
Enabled: true,
|
||||
@@ -112,6 +100,24 @@ func NewDefaultExtensions() []Extension {
|
||||
"maxTranslationLength": 5000,
|
||||
},
|
||||
},
|
||||
{
|
||||
ID: ExtensionMarkdown,
|
||||
Enabled: true,
|
||||
IsDefault: true,
|
||||
Config: ExtensionConfig{},
|
||||
},
|
||||
{
|
||||
ID: ExtensionHighlightWhitespace,
|
||||
Enabled: true,
|
||||
IsDefault: true,
|
||||
Config: ExtensionConfig{},
|
||||
},
|
||||
{
|
||||
ID: ExtensionHighlightTrailingWhitespace,
|
||||
Enabled: true,
|
||||
IsDefault: true,
|
||||
Config: ExtensionConfig{},
|
||||
},
|
||||
|
||||
// UI增强扩展
|
||||
{
|
||||
@@ -124,6 +130,18 @@ func NewDefaultExtensions() []Extension {
|
||||
"autohide": false,
|
||||
},
|
||||
},
|
||||
{
|
||||
ID: ExtensionLineNumbers,
|
||||
Enabled: true,
|
||||
IsDefault: true,
|
||||
Config: ExtensionConfig{},
|
||||
},
|
||||
{
|
||||
ID: ExtensionContextMenu,
|
||||
Enabled: true,
|
||||
IsDefault: true,
|
||||
Config: ExtensionConfig{},
|
||||
},
|
||||
|
||||
// 工具扩展
|
||||
{
|
||||
|
||||
@@ -16,13 +16,8 @@ type KeyBindingCommand string
|
||||
|
||||
const (
|
||||
// 搜索扩展相关
|
||||
ShowSearchCommand KeyBindingCommand = "showSearch" // 显示搜索
|
||||
HideSearchCommand KeyBindingCommand = "hideSearch" // 隐藏搜索
|
||||
SearchToggleCaseCommand KeyBindingCommand = "searchToggleCase" // 搜索切换大小写
|
||||
SearchToggleWordCommand KeyBindingCommand = "searchToggleWord" // 搜索切换整词
|
||||
SearchToggleRegexCommand KeyBindingCommand = "searchToggleRegex" // 搜索切换正则
|
||||
SearchShowReplaceCommand KeyBindingCommand = "searchShowReplace" // 显示替换
|
||||
SearchReplaceAllCommand KeyBindingCommand = "searchReplaceAll" // 替换全部
|
||||
ShowSearchCommand KeyBindingCommand = "showSearch" // 显示搜索
|
||||
HideSearchCommand KeyBindingCommand = "hideSearch" // 隐藏搜索
|
||||
|
||||
// 代码块扩展相关
|
||||
BlockSelectAllCommand KeyBindingCommand = "blockSelectAll" // 块内选择全部
|
||||
@@ -78,9 +73,6 @@ const (
|
||||
HistoryRedoCommand KeyBindingCommand = "historyRedo" // 重做
|
||||
HistoryUndoSelectionCommand KeyBindingCommand = "historyUndoSelection" // 撤销选择
|
||||
HistoryRedoSelectionCommand KeyBindingCommand = "historyRedoSelection" // 重做选择
|
||||
|
||||
// 文本高亮扩展相关
|
||||
TextHighlightToggleCommand KeyBindingCommand = "textHighlightToggle" // 切换文本高亮
|
||||
)
|
||||
|
||||
// KeyBindingMetadata 快捷键配置元数据
|
||||
@@ -124,41 +116,6 @@ func NewDefaultKeyBindings() []KeyBinding {
|
||||
Enabled: true,
|
||||
IsDefault: true,
|
||||
},
|
||||
{
|
||||
Command: SearchToggleCaseCommand,
|
||||
Extension: ExtensionSearch,
|
||||
Key: "Alt-c",
|
||||
Enabled: true,
|
||||
IsDefault: true,
|
||||
},
|
||||
{
|
||||
Command: SearchToggleWordCommand,
|
||||
Extension: ExtensionSearch,
|
||||
Key: "Alt-w",
|
||||
Enabled: true,
|
||||
IsDefault: true,
|
||||
},
|
||||
{
|
||||
Command: SearchToggleRegexCommand,
|
||||
Extension: ExtensionSearch,
|
||||
Key: "Alt-r",
|
||||
Enabled: true,
|
||||
IsDefault: true,
|
||||
},
|
||||
{
|
||||
Command: SearchShowReplaceCommand,
|
||||
Extension: ExtensionSearch,
|
||||
Key: "Mod-h",
|
||||
Enabled: true,
|
||||
IsDefault: true,
|
||||
},
|
||||
{
|
||||
Command: SearchReplaceAllCommand,
|
||||
Extension: ExtensionSearch,
|
||||
Key: "Mod-Alt-Enter",
|
||||
Enabled: true,
|
||||
IsDefault: true,
|
||||
},
|
||||
|
||||
// 代码块核心功能快捷键
|
||||
{
|
||||
@@ -496,15 +453,6 @@ func NewDefaultKeyBindings() []KeyBinding {
|
||||
Enabled: true,
|
||||
IsDefault: true,
|
||||
},
|
||||
|
||||
// 文本高亮扩展快捷键
|
||||
{
|
||||
Command: TextHighlightToggleCommand,
|
||||
Extension: ExtensionTextHighlight,
|
||||
Key: "Mod-Shift-h",
|
||||
Enabled: true,
|
||||
IsDefault: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user