GithubHelp home page GithubHelp logo

phpstormprotocol's Introduction

Overview

This app allows to use phpstorm:// protocol to open a file in a PhpStorm IDE the same way as it's done in TextMate, (section 21.2).

NOTE: Built-in idea:// and phpstorm:// protocols are supported in PhpStorm 8 EAP 138.190+ according to this comment.

Following string must be specified as an editor in your app:

phpstorm://open?url=file://%f&line=%l

Alternative syntax is supported for cross-platform compatibility with PhPStorm 8+ (Mac version)

phpstorm://open?file=%f&line=%l

If something doesn't work, then feel free to submit an issue on GitHub.

More reading about protocol handlers: http://pla.nette.org/en/how-open-files-in-ide-from-debugger.

Installing on Linux

A package for Arch Linux (Arch, Manjaro, Antergos, etc.) is available from the AUR. If you're using other Linux distribution then follow these instructions:

  1. clone https://github.com/sanduhrs/phpstorm-url-handler repository
  2. go to cloned folder
  3. read installation instructions in README.md
  4. delete cloned folder

Installing on Mac

Please follow instructions from the this page if the PhpStorm Protocol.app won't work as expected on your OS X version. PhpStorm 8+ (Mac version only) has built-in url handler and phpstorm://open?file=%f&line=%l url needs to be used instead (see https://youtrack.jetbrains.com/issue/IDEA-65879).

  1. clone this repository
  2. go to cloned folder
  3. copy folder PhpStorm Protocol.app to /Applications/ folder
  4. delete cloned folder

Installing on Windows

  1. clone this repository
  2. go to cloned folder
  3. copy folder PhpStorm Protocol (Win) to C:\Program Files\ folder
  4. double click on C:\Program Files\PhpStorm Protocol (Win)\run_editor.reg file
  5. agree to whatever Registry Editor asks you
  6. update settings at C:\Program Files\PhpStorm Protocol (Win)\run_editor.js file, because each PhpStorm version is installed into it's own sub-folder!

    run_editor.js:

    // Set to folder name, where PhpStorm was installed to (e.g. 'PhpStorm')
    folder_name: '<phpstorm_folder_name>',
    
    // Set to window title (only text after dash sign), that you see, when switching to running PhpStorm instance
    window_title: '<phpstorm_window_title>',
    

    updated run_editor.js

    // Set to folder name, where PhpStorm was installed to (e.g. 'PhpStorm')
    folder_name: 'PhpStorm 2017.1.4',
    
    // Set to window title (only text after dash sign), that you see, when switching to running PhpStorm instance
    window_title: 'PhpStorm 2017.1.4',
    
  7. delete cloned folder

Working under another path?

You can make use of the [project alias settings](/PhpStorm Protocol (Win)/run_editor.js#L11-L14) in case you are working under a network share or Vagrant.

phpstormprotocol's People

Contributors

aik099 avatar amacsmith avatar asika32764 avatar bobbravo2 avatar falkohilbert avatar harcod avatar hason avatar kamilpesek avatar king2500 avatar restuff avatar rvanlaak avatar shaffe-fr avatar snowbaha avatar theveloperspl avatar tkleinhakisa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phpstormprotocol's Issues

wsl + docker + win10 problem

I use sail - docker + win10(wsl) in my laravel project. My projects dir is "\wsl$\Ubuntu\home\vladimirb\projects"
base exception link:

phpstorm://open?file=%2Fhome%2Fvladimirb%2Fprojects%2Flearn%2Fe-com-laravel%2Fresources%2Fviews%2Fwelcome.blade.php&line=20

and it opens well when i manually type in browsers url line:

phpstorm://open?file=\\wsl$\Ubuntu\%2Fhome%2Fvladimirb%2Fprojects%2Flearn%2Fe-com-laravel%2Fresources%2Fviews%2Fwelcome.blade.php&line=20

My question is: what should i use here in cfg file:

 // In case your file is mapped via a network share and paths do not match.
 // eg. /var/www will can replaced with Y:/
    projects_basepath: '',
    projects_path_alias: '',

?

How to manage it to work with projects on vagrant

I'm using a vagrant box as my development environment. My host OS is windows 7 and the guest is a linux based machine. My code base is shared between host and guest so the path of the project is something like D:\vagrant\PROJECT_NAME\code and /var/www/html/NAME/on the host and guest machines respectively.

The generated link is something like pstorm://open/?url=file:///var/www/html/NAME/app/cache/dev/classes.php&line=2061 which has not a valid path on the windows. How can I mange it to work? Maybe adding two options to replace first part of the file path?

The system cannot find the file specified

Hello,

I followed the instructions for Windows but for some reason it's not working.

I'm working on Windows 10 and I'm using Laravel 9 which generates the following link on the error page:

phpstorm://open?file=C%3A%5Claragon%5Cwww%5Claravel9%5Croutes%5Cweb.php&line=17

image

What do I need to do in order to make this work?

Regular expression does not match

I was test on Windows 10 64 bit, with phpstorm on symfony 3.2.5 which produce link like this:

phpstorm://open?file=C:\wamp64\myapp\src\App\Controller\MyController.php&line=29

This line of code does not match:

match = /^phpstorm:\/\/open\?(url=file:\/\/|file=)(.+)&line=(\d+)$/.exec(url),

I was develop new simple version of code that work fine:

var arg = WScript.Arguments(0);

arg = arg.replace("phpstorm://open/?file=", "");
var file=arg.substring(0, arg.indexOf("&"));
var line= arg.substring(arg.indexOf("line=")+5);

var objShell = new ActiveXObject("shell.application"); 
objShell.ShellExecute("C:\\Program Files (x86)\\JetBrains\\PhpStorm 2016.3.2\\bin\\phpstorm64.exe",
"--line "+line+" "+ file);

JetBrains toolbox dir

Do you have some details about Toolbox dir? For my environment, I had to change
\\JetBrains\\Toolbox\\apps\\PhpStorm\\ch-0 to ch-1.
ch-1 folder is the only one I have there. I did not find any information for this.

Do you think I am "unusual case" or should we create some PR for this (add new param to configuration)? The problem is that I do not know how to easily get information about Jetbrains folder structure and what's the logic behind it.

PR could be like: https://gist.github.com/KamilPesek/e0447004a0cd75534836eca0ef242cbd

Cannot find file 'C:\Windows\system32\W'

This is great. I'm so close, I can smell it.

Running windows OS / PhpStorm 2018.3.1
I trigger a link: phpstorm://open?url=file://W:/index.php&line=15

First it shows a popup:
"Cannot find file 'C:\Windows\system32\W'"

Then it opens up the file and jumps to line 15.

Any tips to prevent the first popup? It already opens the right file, but the popup each time is a pain.
Also any tips on making PhpStorm focus after the link is clicked?

Provided Framework configuration doesn't work

I'm using:

  • PhpStorm 9.0
  • Symfony 2.7.3

Installed successfully but it doesn't work with pstorm://open/?url=file://%f&line=%l(based on the documentation).
Changed it to pstorm://open/?url=file://%%f&line=%%l and it worked. Does the documentation need to get updated or I'm missing something?

got an error while opening file

Hello, i try to install it on windows 10.
When i opens my file with link phpstorm://open?url=C:/OpenServer/domains/.../BlogPosts.php&line=357
Got an error: Windows Script Host - there is no script engine for file extension ".js".
i changed settings in js file - what i miss?
Thanks.

Can open file in PHPStrom8

I just updated to PHPStorm8.
The command /usr/local/bin/pstorm [file]:[line] does not really do its job. Nothing happens. Is this something you know about? Am I doing something wrong? Should I contact Jetbrains instead?

Please add to urldecode for linux

links in the browser are encoded like this:

phpstorm://open?file=%2Fmedia%2Fphantom%2FStorage%2FProjects%2FE-cabinet%2FE-cabinet%2Fapp%2FHttp%2FInterfaces%2FApi1CSoap.php&line=21

The PhpStorm opens them as a file without decoding the characters %2F thus it turns out that the program opens a file named

%2Fmedia%2Fphantom%2FStorage%2FProjects%2FE-cabinet%2FE-cabinet%2Fapp%2FHttp%2FInterfaces%2FApi1CSoap.php

It work but with error

when i click on link this box show:
image

and after choice first option do noting.
but when i add phpstormX64 from path as secound options and click on it show this error:

image

it is only work in firefox and show this error!

Windows 10 - No error but file is not open

Hello,

I am running the script with Windows 10 (FR) 64 bits and PHPstorm 2017.

I adapt the reg with :
[HKEY_CLASSES_ROOT\phpstorm\shell\open\command] @="wscript \"C:\\Program Files (x86)\\PhpStorm Protocol (Win)\\run_editor.js\" \"%1\""

and the JS with :

var settings = {
	// Set to 'true' (without quotes) if run on Windows 64bit. Set to 'false' (without quotes) otherwise.
	x64: false,

	// Set to folder name, where PhpStorm was installed to (e.g. 'PhpStorm')
	folder_name: 'PhpStorm 2016.3',

	// Set to window title (only text after dash sign), that you see, when switching to running PhpStorm instance
	window_title: 'PhpStorm 2017.1.3',

	// In case your file is mapped via a network share and paths do not match.
	// eg. /var/www will can replaced with Y:/
	projects_basepath: '',
	projects_path_alias: ''
};

// dont change anything below this line, unless you know what youre doing
var	url = WScript.Arguments(0),
	match = /^phpstorm:\/\/open\?(url=file:\/\/|file=)(.+)&line=(\d+)$/.exec(url),
	project = '',
	editor = '"C:\\' + (settings.x64 ? 'Program Files (x86)' : 'Program Files') + '\\JetBrains\\' + settings.folder_name + '\\bin\\

>phpstorm.exe

"';

But It does not work and I have no errors :
Image demo : I clicked on the Controller file : https://vgy.me/OiVhlQ.png
Open with the script : https://vgy.me/jBi1Hk.png
...And nothing happen :(

Edit :
On my config.yml I wrote : ide: 'phpstorm://open?url=file://%%f&line=%%l'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.