Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add style setting Show different highlights for different scopes Use last selection for multiple selections
- Loading branch information
1 parent
2523c20
commit 4b4606d
Showing
8 changed files
with
143 additions
and
67 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
import imp | ||
import sys | ||
|
||
import sublime | ||
import sublime_plugin | ||
|
||
from .src.state import * | ||
from .src.commands import * | ||
from .src.listeners import * | ||
from .src import * | ||
|
||
def plugin_loaded(): | ||
print("Semantic Highlighter loaded") | ||
global settings, syntax_scopes | ||
|
||
settings = sublime.load_settings('SemanticHighlighter.sublime-settings') | ||
|
||
settings.clear_on_change('scopes') | ||
settings.add_on_change('scopes', plugin_loaded) | ||
|
||
if (settings.has('scopes')): | ||
syntax_scopes = settings.get('scopes', {}) | ||
settings.clear_on_change('style') | ||
settings.add_on_change('style', plugin_loaded) | ||
|
||
def plugin_unloaded(): | ||
print("semantic highlighter unloaded") | ||
state['style'] = styles[settings.get('style', 'underline')] | ||
state['syntax_scopes'] = settings.get('scopes', {}) | ||
|
||
class SemanticHighlighterDebugCommand(sublime_plugin.TextCommand): | ||
def run(self, edit): | ||
print("debug") | ||
analyzer = ScopeAnalyzer(); | ||
selection = self.view.sel() | ||
analyzer.guess_block(self.view, selection[0]) | ||
analyzer.analyze(self.view, selection[0]) | ||
|
||
class SemanticHighlighterMarkCommand(sublime_plugin.TextCommand): | ||
def run(self, edit): | ||
print("keyboard") | ||
self.view.run_command('semantic_highlighter_highlight', { "locked": True }) | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"style": "underline", | ||
"scopes": { | ||
"base": [ | ||
"variable.other", | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
from .state import * | ||
from .helpers import * | ||
from .commands.highlight import * | ||
from .commands.toggle import * | ||
from .listeners.view_event import * |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
import sublime | ||
|
||
# global vars | ||
settings = {} | ||
syntax_scopes = {} | ||
syntax = None | ||
highlight_enabled = False | ||
highlight_regions = {} | ||
current_selection = None | ||
highlight_tags = {} | ||
selection_lock = False | ||
|
||
styles = { | ||
'outline': sublime.DRAW_NO_FILL, | ||
'fill': sublime.DRAW_NO_OUTLINE, | ||
'underline': sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE | sublime.DRAW_SOLID_UNDERLINE | ||
} | ||
|
||
state = { | ||
"current_highlight": None | ||
"syntax_scopes": {}, | ||
"current_highlight": {} | ||
} |