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

Search by filename #20

Closed
olafurpg opened this issue Jun 28, 2017 · 7 comments
Closed

Search by filename #20

olafurpg opened this issue Jun 28, 2017 · 7 comments

Comments

@olafurpg
Copy link
Member

olafurpg commented Jun 28, 2017

It would be nice if it was possible to open a particular file by searching its name. Ideally, this should be possible in a similar way as vscode does it with Cmd+P

jun-28-2017 22-36-26

Also, the url hash should ideally follow the active filename so that it's possible to share a link to a specific filename (+ line number)

@olafurpg
Copy link
Member Author

olafurpg commented Sep 19, 2017

Been demoing metadoc at Scala World, missing this functionality a lot!

@jonas
Copy link
Collaborator

jonas commented Sep 19, 2017

Yes. Are all file names in the workbench index?

@olafurpg
Copy link
Member Author

olafurpg commented Sep 19, 2017 via email

@olafurpg
Copy link
Member Author

olafurpg commented Jun 4, 2018

A few relevant links

workspace.filenames: Seq[String] includes all the filenames in the workspace

https://github.com/scalameta/metadoc/blob/ecb37f35612464a5c73469ed961f21c4b97bb483/metadoc-js/src/main/scala/metadoc/MetadocApp.scala#L48

One idea, I'm wondering if it is possible to use DocumentSymbolProvider to jump to different URIs than the current open buffer 🤔 The API seems to allow returning SymbolInformation which may be able to have .location.uri and .kind
https://microsoft.github.io/monaco-editor/api/interfaces/monaco.languages.symbolinformation.html#kind Might be worth a shot.

@olafurpg
Copy link
Member Author

olafurpg commented Jun 4, 2018

I tried to use DocumentSymbolProvider to switch URI but it seems monaco doesn't like that. It looks very promising however since there exists a SymbolKind.file which has a nice icon

screen shot 2018-06-04 at 21 38 10

Seems we may need to register our own command using
CommonEditorRegistry as requested microsoft/vscode#7250

I tried

@JSGlobal("monaco.CommonEditorRegistry")
@js.native
object CommonEditorRegistry extends js.Object {
  def registerEditorAction(editorAction: IEditorAction): Unit = js.native
}

but hit on Cannot read property 'registerEditorAction' of undefined.

@olafurpg
Copy link
Member Author

olafurpg commented Jun 4, 2018

The objective is to reproduce the following typescript snippet https://github.com/Microsoft/vscode/blob/047b88c39ccb5875356276ae98b7429e4b279d6a/src/vs/editor/standalone/browser/quickOpen/quickOutline.ts#L113-L130 to register a custom command "Open file"

@olafurpg
Copy link
Member Author

olafurpg commented Jun 4, 2018

Registration of commands seems to have been changed in the latest monaco version https://github.com/Microsoft/vscode/blob/d328fec640d2f2b78faa501ecd613cb0312c8472/src/vs/workbench/parts/quickopen/browser/quickopen.contribution.ts#L37-L39 and it seems CommonEditorRegistry no longer exists.

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

2 participants