Skip to content

Commit

Permalink
Added more IDE links
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterj authored and fabpot committed May 5, 2014
1 parent e14f007 commit 239b738
Showing 1 changed file with 2 additions and 0 deletions.
Expand Up @@ -359,6 +359,8 @@ private function registerTemplatingConfiguration(array $config, $ide, ContainerB
$links = array(
'textmate' => 'txmt://open?url=file://%%f&line=%%l',
'macvim' => 'mvim://open?url=file://%%f&line=%%l',
'emacs' => 'emacs://open?url=file://%file&line=%line',
'sublime' => 'subl://open?url=file://%file&line=%line',
);

$container->setParameter('templating.helper.code.file_link_format', isset($links[$ide]) ? $links[$ide] : $ide);
Expand Down

5 comments on commit 239b738

@rvanlaak
Copy link
Contributor

Choose a reason for hiding this comment

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

Any chance to add this for Eclipse? I've been seaching for such an URL for Eclipse but was unable to find it. Maybe support was added via http://symfony.dubture.com plugins.

@stof
Copy link
Member

@stof stof commented on 239b738 May 13, 2014

Choose a reason for hiding this comment

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

well, this should be asked to the eclipse team to know whether they support such way to open files through a custom protocol. It is not something implemented in Symfony but in emacs/sublime/macvim/textmate

@nifr
Copy link

@nifr nifr commented on 239b738 May 15, 2014

Choose a reason for hiding this comment

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

Eclipse URL handler (from an old EverNote note of mine)

While support for opening files from CLI was introduced in 02-2010 (9 years after the original request) ...

... Eclipse does not (yet) support opening files at a certain line number - see this bug which has been open for 4+ years now.

Opening files with Eclipse from CLI works like this:

eclipse --launcher.openFile myFile.txt

You can add --launcher.timeout 10 and eclipse will try to open the file in an exisiting instance for 10 seconds - after the timeout it opens the file in a new instance ( default: 60 ).

... or if you have --launcher.defaultAction openFile as a default launch option in eclipse.ini you can ommit the --launcher.openFile flag like this

eclipse myFile.txt

Registering the URL handler

Linux
Instructions for registering URL handlers / custom schemes on Linux can be found here.

Windows
Registering the eclipse:// scheme / url handler can be done like this - more information can be found here

reg add HKCR\eclipse /ve /d "URL:Eclipse Protocol" 
reg add HKCR\eclipse /v "URL Protocol" 
reg add HKCR\eclipse\Shell\Open\Command /ve /d "eclipse.exe --launcher.OpenFile %%1"

You either have to have eclipse.exe in your PATH or prepend the complete path to the third command.

OSX

For completeness - instructions for OSX can be found here.

Other solutions?

There is a wrapper tool / plugin called EclipseCall from 2008 that supports opening files at a certain line and highlighting lines via sockets.

Eclipse Remote Control can open files in existing workspaces at line xy (but not absolute paths to files).

Eclipse Java Development Tools (JDT) has an openFromClipboard command that can open files from clipboard and jump to a line number according to this comment.

@wouterj
Copy link
Member Author

Choose a reason for hiding this comment

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

After you have enabled the eclipse scheme, you can define it as described in the docs

@nifr
Copy link

@nifr nifr commented on 239b738 May 15, 2014

Choose a reason for hiding this comment

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

👍 Good idea to leave the link to the docs here. @wouterj.

btw. the most common syntax is i.e. vim +21 /etc/hosts - works for:

vim +<line> <filepath>
nano +<line> <filepath>
emacs +<line> <filepath>
...

Please sign in to comment.