Is there an API to open the fileTree and trigger the highlight of currently open file?
I’d like to make sure the fileTree is always open at theia startup.
@jeluard it is definitely possible, you can rebind
FileNavigatorContribution
to update the onStart
lifecycle hook to perform something similar to the getting-started
widget (to open the view on startup).
If you’d like to highlight a node in the tree, you can use the ApplicationShell
to determine if there are any currently opened editors present in the application and highlight (selectNode
) the tree node.
Additional Information:
Thanks!
Can I highlight a specific file in the FileTree using this method?
The highlight of a currently opened file is already supported, but if you’d like to highlight a specific node in the tree (given that you identify the node) you can call selectNode
to highlight it.
rebind
FileNavigatorContribution
Can you be more specific? How to “rebind” a contribution
@y912765390 sure, we have many examples already in the forum but in any case you’ll need to create a custom theia extension and use inversify’s dependency injection to rebind
the original class to your implementation.
Here is an example from a previous discussion: How to remove some UI elements - #4 by vince-fugnitto.