Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Add core URI handlers - #15935

Merged
BinaryMuse merged 17 commits into
masterfrom
mkt-core-uri-handlers
Nov 3, 2017
Merged

BinaryMuse merged 17 commits into
masterfrom
mkt-core-uri-handlers

Conversation

@BinaryMuse

@BinaryMuse BinaryMuse commented Oct 18, 2017 •

Copy link
Copy Markdown
Contributor

Atom core should include URI handlers for extremely common tasks, like opening files. This PR implements any such handlers. 💭 s for other useful handlers are welcome.

  • Open file (with optional line and column numbers) — atom://core/open/file?filename=urlEncodedFileName&line=n&column=n

Todo

Closes #2037

@BinaryMuse

Copy link
Copy Markdown
Contributor Author

For the /core/open/file handler, it seems like it might be useful to do some URI parsing from the main process in order to call AtomApplication#windowForPaths or something similar to figure out which window we should route the URI event to.

On the other hand, package authors may wish to have access to similar information (that is, meta information about the various open Atom windows), so perhaps we should expose this across the application delegate somehow so it's accessible from renderer process code.

@BinaryMuse

Copy link
Copy Markdown
Contributor Author

This works, although it's not my absolute favorite strategy here. Open to 💭 s from @atom/maintainers if anyone has any :)

@UziTech

UziTech commented Oct 30, 2017

Copy link
Copy Markdown
Contributor

I registered the open package to allow a link with the TextMate URL scheme to be open in Atom:

atom://open?url=file:///path/to/file.ext&line=10&column=2

One thing that would be really nice is if Atom could open an entire project that the file is in if it is not already open.

I'm not sure how we would define project, but that is my two cents.

@socketPath = null if options.test or options.benchmark or options.benchmarkTest
@pidsToOpenWindows = {}
@windows = []
@windows = new WindowStack()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎨 Might be nice to rename @windows to @windowStack to help emphasize that it's an object, not an array.

@BinaryMuse
BinaryMuse merged commit a3bb0bb into master Nov 3, 2017
@BinaryMuse
BinaryMuse deleted the mkt-core-uri-handlers branch November 3, 2017 01:40
@Ben3eeE

Ben3eeE commented Nov 3, 2017

Copy link
Copy Markdown
Contributor

👏 🎉

@nathansobo

Copy link
Copy Markdown
Contributor

💥

win = new AtomWindow(this, @fileRecoveryService, {resourcePath, windowInitializationScript, devMode, safeMode, windowDimensions, env})
@windowStack.addWindow(win)
win.on 'window:loaded', ->
win.sendURIMessage url

@UziTech UziTech Nov 4, 2017 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BinaryMuse Any way we could use HistoryManager to check if url is in a project then load the entire project and open the url?

maybe we would want a setting to open individual files or project if found?

@RobinDaugherty

Copy link
Copy Markdown

@BinaryMuse it seems that line number in the URL is treated as a zero-indexed number while all other editors (and the Atom UI) treat this number as one-indexed. So a link to line=56 lands on line 57 in the UI. It seems like it might be best to change this to conform to other editors. Any preference?

@BinaryMuse

Copy link
Copy Markdown
Contributor Author

@RobinDaugherty Yes, I agree with you. I'll merge a change shortly to fix this. Thanks!

fabpot added a commit to symfony/symfony that referenced this pull request Dec 11, 2017
This PR was merged into the 4.1-dev branch.

Discussion
----------

[FrameworkBundle] Add atom editor to ide config

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

<!--
- Bug fixes must be submitted against the lowest branch where they apply
  (lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against the master branch.
- Replace this comment by a description of what your PR is solving.
-->

Support for uri handler (added [here](atom/atom#15935)) in Atom editor is still in the current beta version. This works only for windows and mac.

Commits
-------

191b837 [FrameworkBundle] Add atom editor to ide config
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants