Skip to content
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

Sidebar API #867

Open
josecanciani opened this issue Jun 1, 2015 · 35 comments
Open

Sidebar API #867

josecanciani opened this issue Jun 1, 2015 · 35 comments

Comments

@josecanciani
Copy link

I know there are several sidebar related issues opened, but I could not find any related specifically to an API.

I'll be glad to maintain a list of features we would like for a Sidebar API here. Here is a short list with my own:

  • Style items: allow for dynamically changing icons, font type and color.
    Use cases: Git integration showing modified files and folders. Show unit tests that are current failing.
  • Easy context menu modification when right clicking files in the sidebar.
    Use cases: if it's a test, be able to run it. Having custom launchers or activities like git commands, opening in different programs, etc.
  • Refresh triggers so we can add our own behaviour to new items

Thanks!

@FichteFoll
Copy link
Collaborator

You can do the menu modification already with is_visible or is_enabled callbacks in the referenced command's class.

I don't understand what you mean with "refresh triggers".


If we're collecting ideas for a sidebar API, I propose the ability to create a sidebar (and sidebar items) entirely by plugin code. For example a virtual SFTP file tree or a code outline.

See also http://www.sublimetext.com/forum/viewtopic.php?f=2&t=17470&p=65484&hilit=sidebar#p65484 and http://www.sublimetext.com/forum/viewtopic.php?f=2&t=17470&p=65775&hilit=sidebar#p65775.

@josecanciani
Copy link
Author

Thanks for your comments. By "refresh triggers" I meant to be able to listen when things change in the side bar. Sublime listens for changes in the directories you are showing, so if I have a plugin that colourize a file, I would like that new files appearing in the sidebar are also colourized properly. So a listener would allow my plugin to "redraw" or "theme" it even if it's a new item.

Can you explain or provide a link to the is_visible/is_enabled callbacks you mention? What kind of modification can already be done? I have only found tmThemes that allow some kind of visual manipulation of the file list in the sidebar, but I yet have to found a programmatic approach to it.

@FichteFoll
Copy link
Collaborator

Refresh triggers would then be something similar to #626.

It's kind of a mixed thing. You add the menu item as you do normally, via Sidebar.sublime-menu, and then specify a command name. In the command's class you then define an is_visible method that is called (with all parameters, notably files) and should return a boolean.

You can find an example in Default/open_context_url.py, except that this is in the general context menu.

@anatomatic
Copy link

Related: Issue #328 - Sidebar Sort Options

@igormucsicska-planorama
Copy link

+1 for Style items to allow Git integration showing modified files and folders.

@Invictus321
Copy link

Git integration on the sidebar would be great

@vincentfs
Copy link

Styling items for Git integration is extremely appreciated.

@sam2332
Copy link

sam2332 commented Jan 11, 2017

i hope you can get the sidebar api into the latest release soon.

@ghost
Copy link

ghost commented Feb 14, 2017

This needs to be implemented! it would be great!

@ronilaukkarinen
Copy link

+1 👍
Only thing missing from my Sublime Text setup :)

@sublimehq sublimehq deleted a comment from affanshahid Aug 3, 2017
@sublimehq sublimehq deleted a comment from gianfortune Aug 16, 2017
@sublimehq sublimehq deleted a comment from matteoterrinoni Jan 18, 2018
@tbjgolden
Copy link

I can count 3 or 4 fellow devs who've asked how I cope without it - would make a huge difference!

@rudwolf
Copy link

rudwolf commented Feb 15, 2018

Well, we are on sublime text 3 and I thought that maybe this feature would be already implemented =/

Is it so hard to do it?

@chall-loom
Copy link

As with others who have posted, the lack of any feedback on file change status on the sidebar (i.e., an api to support such features) is a major drawback that I've been working around since switching to sublime several years ago. Is there any intention of putting this on the roadmap? It would be good to know one way or the other so folks can assess whether it is worth it to continue living with it or seek out alternatives.

@rudwolf
Copy link

rudwolf commented May 7, 2018

@wbond Are you there buddy? I just updated to version 3.1 and I expected that including theme changes you could have done something about that too, can we help and be able to code it ourselves? Is there any date we can expect this to be implemented?

@wbond
Copy link
Member

wbond commented May 7, 2018

I am here, and I am just as interested as you are for a sidebar API. We definitely have some plans for some good stuff coming up, and I will certainly update this issue when there is more info about the sidebar.

A lot of the work in this dev cycle went into making some core elements of the editor more polished so that we can set the stage for some bigger changes. We didn't want to keep adding new things on top of a base that needed some foundational work.

@LucasArruda
Copy link

Awesome @wbond. That is like that one thing missing from ST that would make it perfect.

@kat0d
Copy link

kat0d commented Oct 13, 2018

+1

@FichteFoll
Copy link
Collaborator

3181 added git status indicators to the sidebar.

There is no API yet, however.

@rudwolf
Copy link

rudwolf commented Dec 3, 2018

I'm waiting for this for a long time, I think it's been 2, almost 3 years, I hope it comes with next update!

@Zren
Copy link

Zren commented Dec 4, 2018

I downloaded the beta to check it out. Here's what it looks like as of Build 3183.

Git ignored files have lighter text. Unstaged files have an empty circle next to it, and modified files have a blur filled circle next to it.

Default Theme

2018-12-03___21-47-00

Adaptive Theme

2018-12-03___21-56-54

@ghost
Copy link

ghost commented Dec 4, 2018 via email

@Zren
Copy link

Zren commented Dec 6, 2018

Now testing Build 3184

  • Deleted files don't appear in the sidebar so no annotation. The parent folder also no annotation that a file was deleted from it.
  • Modified files when staged have a chevron arrow symbol.
  • Newly added files that are staged look the same, but green.

It seems there is a difference between "added" and "modified", however I appear to have run into a bug though.

2018-12-06___02-00-21
2018-12-06___02-01-20

If you only have "Modified / Staged" and "Added", it'll show "Added" correctly as green. However if you also stage a git removed file, it'll treat it the added file as just "Staged".

However if you have staged a "removed" file in the folder, it will treat it as "Staged".

2018-12-06___01-42-03

Build 3184 mentions "Improved visualization of ignored files" but I don't see any difference from my previous screenshots.

2018-12-06___01-50-13

2018-12-06___01-52-21

@dimmech
Copy link

dimmech commented Jan 21, 2019

@wbond
Copy link
Member

wbond commented Jan 21, 2019

A sidebar API would be unlikely to modify existing functionality of the Folder tree. Instead, it is more likely there would be the ability to create a custom tree. We would possibly allow providing VCS statuses for non-Git version control systems.

@AmjadHD
Copy link

AmjadHD commented Feb 6, 2019

@wbond since we're bringing the sidebar, would you add the ability to move files with drag and drop, that would be very appreciated.

@FichteFoll
Copy link
Collaborator

@AmjadHD we have a separate issue for that: #16

@mihneabalta
Copy link

I'm working on a build system and I'd like to integrate it into Sublime. It would be really useful to me if there was a sidebar API with the following features:

  1. Ability to customize items, similar to the newly introduced git integration: de-emphasize items, add badges.

  2. Custom data providers for the sidebar. I would use this to display build targets which can be expanded to show their dependency trees. If the default filesystem provider is made public, plug-ins can also derive from it to implement filtered views (e.g. remove files which do not participate in the build, or add entries for source controlled but locally deleted files). Data providers should also be able to style the items they output (and customizations are applied on top of that).

  3. Multiple sidebar tabs, each with its own data provider (similar to the solution explorer/resource view/class view in Visual Studio).

Point 1 may be a bit tricky in case multiple plug-ins want to customize the same item (e.g. the git integration and my build system). Maybe plug-ins should only be allowed to add badges (but you can end up with 15 badges per item), or only one customization plug-in can be active at a given time (but then you need to allow the user to pick), or you just hope plug-in writers will pick non-conflicting customizations (yeah, right).

Please? :)

@bmix
Copy link

bmix commented May 7, 2019

The reasons, I would like a sidebar API, are:

  • Show tree of nodes for JSON and XML files.
  • Show functions and constants, grouped by namespace and/or file.
  • Show class/object hierarchies, etc.
  • Show list of build targets in current project.
  • Keep a list of TODOs.
  • Bookmarks for source code.
  • Chapters, titles, etc. like in Markdown.

Having an input for filtering expressions, would also be cool.

It's really the item I am most missing from Sublime Text (the other ones being dialogs for plugins (good for defining presets/ passing values in complex build scenarios) and a bottom pane, that could show live documentation, relative to the expression under the cursor, like function signatures). So, kudos for considering it! Very much appreciated!

@Ajinkz
Copy link

Ajinkz commented Nov 12, 2019

@wbond
I was looking for Sidebar API on the sublime forum and end up getting here.
Looking forward for implementing something like this. whether it is possible in sublime ?
image
image

@jfcherng
Copy link

@Ajinkz Though he said #867 (comment). But now, no.

@seanmorris
Copy link

I'd love to be able to add arbitrary trees to the sidebar. Any traction on this one?

@AmjadHD
Copy link

AmjadHD commented Feb 3, 2021

A good addition would be to allow plugins to create their commands that work on sidebar items, without triggering the sidebar menu, possibly binding it to a key. For that a sidebar_focused context should be added.
e.g backspace (or delete) key bound to a delete_file command, deletes the selected files.

@flukejones
Copy link

I would really like to see at least a simple API where plugins (particularly LSP) can display an icon at least. The only thing I (personally) need so I can use ST almost full time is for files that LSP says have errors to display a red dot next to their names in the sidebar - this is super duper incredibly handy for doing refactoring work.

@rudwolf
Copy link

rudwolf commented May 2, 2022 via email

@flukejones
Copy link

I keep coming back to ST4 because VSCode is terrible on Wayland. And then leaving because it becomes too difficult to track a multi-file error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests