Introduce new optional parameter in run_command() method:
def run_command(command_name, cmd_params, lock=None)):
It would be wonderful if commands executed witch run_command could be synchronized by use of threading.Lock.
Thanks
Introduce new optional parameter in run_command() method:
def run_command(command_name, cmd_params, lock=None)):
It would be wonderful if commands executed witch run_command could be synchronized by use of threading.Lock.
Thanks
I would like to see a Block Decorations API like Atom has: http://blog.atom.io/2016/02/03/introducing-block-decorations.html
The API could be as simple as this:
ref = view.add_block_decoration(after_line=12, html=html_string)
view.remove_block_decoration(ref)
Presumably this could reuse the existing HTML library that is used for tooltips (with the same type of callbacks for links), but would display persistent but passive inline information between buffer lines.
This would be useful for extended linter information (instead of one line in the status bar), inline image previews, inline latex equation previews, inline documentation, ipython-notebook-style output, just to name a few off the top of my head. There is a lot of potential here and I’m sure people will come up with more ideas, so I would rate this as major.
#+1
As a sidenote to this - I have a plugin concept that could greatly benefit from this functionality. The plugin essentially allows users to define arbitrary code folding points ( as opposed to the default indentation-based system ) by implementing headers, which they can also use to quickly fold/zoom code, open specific sections in new views, navigate sections via quickpanel, etc.
Here are a few other demos.
Some areas where I could see benefit would be - rather than headers occupying the same line-space as code, headers could be in non-code space like:
1> here is
2> some code
////////// This Is A Header /////////
3> here is some more code
I believe this would allow for faster performance by allowing headers to be queried solely within block decorations, rather than performing a RegEx search over the entirety of code.
Some implementations of block decorations that would be useful:
tag
: used to quickly group all block decorations of a particular tag into an array via
tagArray = view.get_decorations( "tagName" )
data{}
: “hidden” dictionary to store associated content ( EG: in the case of my header example, "indentation_level": 3
could be a stored value )
callback
: allows callbacks to be run upon clicking block decorations ( Some sort of method to differentiate left, right, & double clicks might be useful. Also, allow keybinding contexts to implement the tag
property along with is_block_decoration
)
decoration.begin()
& decoration.end()
: return the same results as their region
counterparts
fold markers : allow text to be folded “into” block decorations manually ( +1 for automatic fold-regions in between decorations as an option )
I agree it would be very useful to be able to ask the user for a path using the standard dialogs.
Right now we have very few options like using window.show_input_panel
which requires the user to have copied the path by other means beforehand.
A simple API with callbacks would be just fine:
sublime.show_open_dialog(title:string, initial_path:string, open_dir:bool, on_done:callback, on_cancel:callback)
sublime.show_save_dialog(title:string, initial_path:string, on_done:callback, on_cancel:callback)
Importance: medium
Motivation: Allow plugins to integrate better with sublime
There are few plugins that I could think of that would benefit on a better gutter:
I believe that letting plugins to create their own gutters are a good idea as long it respects the following rules:
I think this should also be here:
It would be nice to have a serializable undo redo/history. So we can undo after closing and reopening sublime… give an api so we do this as we wish.
Importance: high
Motivation: allow painless text manipulation by scopes
Working with scopes is a pain at the moment because we can’t be specific about extracting text for a given scope selector. Instead we have to use extract_scope(point) with its ‘intelligence’ which varies by language. Or, we use find_by_selector(selector), then iterate through the list of regions to find the one that intersects the position we want. Or we move position by position back and forth and check we are in/out of scope. These workarounds are labour & CPU intensive for what should be a very simple thing. The solution:
extract_scope(point, selector)
The above proposed change will extract the region for the given selector if provided. Better still would be:
extract_scope(point, selectors)
Where selectors is a space delimited string of selectors, the largest of which (except topmost source.*) is selected.
Finally we could have a greedy flag which allows the above API to choose the least or most specific selector:
extract_scope(point, selectors, greedy, single)
And the single flag will allow an individual scope to be extracted in the case where they are back to back (like <div><div><div>
)
Rounding off, it would be useful to have more flexibility with find_by_selector(selector), so that we can restrict its operation to a given region or regions. Presently it returns all matching regions in the file, a performance overhead if one needs to iterate through it repeatedly.
find_by_selector(selector, Region or [Regions])
(I’m assuming this qualifies as an API suggestion, I’m not entirely sure though)
One of the most frequent requests for my packages is extending the scope of snippets or completions to other syntaxes. I’ve had a situation where I was asked to extend the scope for HTML completions and add support for JSX. Immediately after those changes were applied, I got complaints from other users of my package about this change. It’s not always easy to judge whether such a change makes sense, especially if you’re not familiar with the syntax.
Therefor, I would love if Sublime Text would allow users to extend/manipulate the scope in which snippets/completions are working without having them to alter the actual files, e.g. in the user settings.
I would like to write a plugin to change workspaces based on the current Git branch.
Currently changing branches in Git can leave the current workspace in a mess:
I tend to manually create a new workspace for each branch:
GIT.[Branchname].sublime-workspace
I have to manually switch workspaces after a checkout.
I have to manually delete workspaces when I delete the branch.
I would like to be able to load workspaces, create and delete them.
Additionally, unrelated to workspaces, but useful for this plugin:
This would allow notification of when the .git/HEAD file is modified (when a checkout occurs), to trigger the workspace switch.
An API to hide a set of lines matching a given criteria (regex or …). When called with None, unhide all hidden lines.
Once hidden, those lines would be excluded from search and edit operations. Similar to what the ‘ALL’ command does on XEDIT and similar editors.
To illustrate, here is a simple directory listing:
Then, after hidding the lines not containing ‘dir’:
Very handy while working with log files and line-oriented files (csv exports, …).
You can still view/search/edit the non-hidden lines, add new content, and so on.
Edit -> Code Folding -> Fold
You can use RegReplace to do it using REGEXP
Menu Edit -> Code Folding -> Fold
Nope:
those lines would be excluded from search and edit operations.
Output panels have really odd behaviors currently. In exec.py
, there is this code:
if not hasattr(self, 'output_view'):
# Try not to call get_output_panel until the regexes are assigned
self.output_view = self.window.create_output_panel("exec")
# [...]
self.output_view.settings().set("result_file_regex", file_regex)
self.output_view.settings().set("result_line_regex", line_regex)
self.output_view.settings().set("result_base_dir", working_dir)
self.output_view.settings().set("word_wrap", word_wrap)
self.output_view.settings().set("line_numbers", False)
self.output_view.settings().set("gutter", False)
self.output_view.settings().set("scroll_past_end", False)
self.output_view.assign_syntax(syntax)
# Call create_output_panel a second time after assigning the above
# settings, so that it'll be picked up as a result buffer
self.window.create_output_panel("exec")
Observations:
Window.create_output_panel
is run twice. But only at the first time..assign_syntax
on the output panel turns it from a widget into an actual view. This causes it to infer its settings from the usual Preferences.sublime-settings
files (or more likely, they are not overridden from some widget-specific thing). As a result, the output panel will have its gutter and line numbers visible, which exec.py
has to disable explicitly. (more on this)Window.create_output_panel
, its entire contents are erased. Settings are not reset, though.Priority: minor (it’s “always” been like this and changing behavior of create_output_panel
especially wrt 3. would be a breaking change)
Related: API Suggestions
Putting scopes to work
So far, scopes use is limited: syntax coloration and some limited hard-coded features (‘go to symbol’, mostly).
What about extending them, in two ways:
Priority: minor
Speaking about putting scopes to work:
I’d like to have scope based folding instead of just indent based folding.
Similar to the tmPreferences
files used by the symbol list,
a setting file would allow to control which scope can be folded.
Importance: Major
Also I’d like scope based auto-indentation.
Now the Indentation.tmPreferences
is doing regex matching while all the information we need is already extracted by the syntax.
Importance: Minor (since there is already a working mechanism albeit limited)
I also wanted to suggest an indentation system that is based on scopes (and the powerful syntax lexing that’s happening all the time anyway), but hold back onto creating an issue for it since I haven’t yet drafted out a specific suggestion on how I would imagine this feature.
I also wonder if it should be part of the syntax definition or utilize a separate scope-selector-oriented mechanism like tmPreferences do.
Another thing that I’d like is improved parsing of the output panel.
For now errors have to be extracted through two regexes, one for the file and one for the line, character offset and message.
So here are 3 suggestions in increasing order of complexity.
the output of the C# compiler doesn’t print full path to files, only the name of the file.
This prevent the “next_result” command to open the correct file.
Proposed fixed: if the matched path doesn’t exist try to open a file in the current project with the same name.
Sometimes the error message is on different line than the line number (eg in Python). So there is no way to capture the error message.
Proposed fix: add a third regex for the error message.
There is no distinctions between errors and warnings. You have to choose when you create the build system if you want to catch both or only errors. Ideally the build system would provide a way to extract both, and the user could choose which one to display.
I hate it that I always find something to comment on in these threads, but I just can’t help it. If that’s not desired, I’ll continue replying to posts in new threads, but I’m on mobile atm.
To 1.: relative file paths are a possibility (and by default relative to the active view’s file’s directory. It can be configured with a setting that you can inspect from exec.py.
To 2.: you can capture the message in the regular expressions, but nothing is really done with it. I think it shows in the status bar on some action.