metabrowse
metabrowse copied to clipboard
Workspace symbol provider
https://code.visualstudio.com/docs/editor/editingevolved#_open-symbol-by-name
The api exists in vscode but not monaco https://github.com/Microsoft/vscode/blob/478365bce508cc391e4cfc5c9e1eeee7c87c39c9/src/vs/vscode.d.ts#L2034
We have all the data to implement this.
We can do this the same way we do for searching for filenames. I would restrict the symbols to global class/object/trait kinds.
Here's a quick mock-up for creating an "omnibar" to search/complete file and symbol names.
input#omnibar {
background-color: rgba(255,255,255,0.1);
border: none;
position: absolute;
top: 10px;
left: 59px;
color: inherit;
font-size: inherit;
height: 36px;
padding-left: 10px;
width: 79%;
}
If I can get that to work (or find a library that allows to easily create a search box with pluggable completion) we should be able to implement this.
@jonas That looks amazing, I might be tempted to implement the completions myself in Scala.js. What would the interface be? I can imagine something like
def completions(query: String): List[String]
I have forever wanted a search bar similar to https://cs.chromium.org
@jonas have you tried to see if we can access the same APIs as QuickOutlineAction for the document symbol provider? https://github.com/Microsoft/vscode/blob/d5b94eb3a7f1fe165590bbd0e685516400050a8f/src/vs/editor/standalone/browser/quickOpen/quickOutline.ts#L115-L151
When looking at switching to the Monaco Webpack plugin (#106) I noticed that it uses the JS sources directly, so it might be possible to access some of that, however, since it is not exposed via the Monaco API I don't know if it is possible.