Coder Social home page Coder Social logo

Comments (23)

aik099 avatar aik099 commented on June 5, 2024

Are you using the latest codebase (from master branch) of this project? I'm asking because there were Windows 10 related fixes recently.

from phpstormprotocol.

Snowbaha avatar Snowbaha commented on June 5, 2024

To be sure, I copied all the code there :
https://github.com/aik099/PhpStormProtocol/blob/master/PhpStorm%20Protocol%20(Win)/run_editor.js

So yes, it is the latest

I added my config.yml

from phpstormprotocol.

aik099 avatar aik099 commented on June 5, 2024

Then I have no idea unfortunately. I know it worked in Windows 7, where I originally tested it upon and some fixes were applied to work on Windows 8 as well.

If you find out what causing it to malfunction, then PR would be welcome.

from phpstormprotocol.

Snowbaha avatar Snowbaha commented on June 5, 2024

Ok, do you know how I can have a log or something to help me to know that is wrong?

from phpstormprotocol.

aik099 avatar aik099 commented on June 5, 2024

No idea. Probably there are some methods on WScript. object that can be used. The Google/MSDN would know better.

from phpstormprotocol.

buddh4 avatar buddh4 commented on June 5, 2024

Same issue here, I had to align the url a bit:

phpstorm://open/?file={file}&line={line}

note the additional / after open

from phpstormprotocol.

aik099 avatar aik099 commented on June 5, 2024

@buddh4 , so if you change phpstorm://open?file={file}&line={line} with phpstorm://open/?file={file}&line={line} in code, that is building links for you (not this protocol listener project), then it works for you?

from phpstormprotocol.

buddh4 avatar buddh4 commented on June 5, 2024

Yes, otherwise the regex does not match and the scripts exits without any errors

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

from phpstormprotocol.

aik099 avatar aik099 commented on June 5, 2024

@buddh4 , please post actual link you click on Windows (working and non-working ones). I want to see how the path with all slashes looks like in there.

from phpstormprotocol.

aik099 avatar aik099 commented on June 5, 2024

Ha, it looks like change made in #25 replaced regex by making / after open a requirement. Before it wasn't needed at all. And now URL in README.md doesn't actually work :(

from phpstormprotocol.

aik099 avatar aik099 commented on June 5, 2024

What if you use phpstorm:// link as in README.md (no / after open) and change regular expression in run_editor.js file from /^phpstorm:\/\/open\/\?(url=file:\/\/|file=)(.+)&line=(\d+)$/ to /^phpstorm:\/\/open\/?\?(url=file:\/\/|file=)(.+)&line=(\d+)$/ (replaced open\/ with open\/?)?

Will it work then as well?

from phpstormprotocol.

Filoz avatar Filoz commented on June 5, 2024

for me the #25 is working on win 10 without doing any others edit

the only edit I made was about the exe path, because I'm using Jetbrains Toolbox

from phpstormprotocol.

buddh4 avatar buddh4 commented on June 5, 2024

Sorry for the confusion, had to do some debugging before it worked and thought it was the regex, but there probably was another issue regarding my url, now it works also without the slash.

My actual problem was, that if I set the x64: true it searches in Program Files (x86), but I have a 64 bit installation in Program Files. I also had to change from phpstorm.exe to phpstorm64.exe

So in my case the following path is valid:

"C:\\Program Files\\JetBrains\\' + settings.folder_name + '\\bin\\phpstorm64.exe"'

from phpstormprotocol.

aik099 avatar aik099 commented on June 5, 2024

Nice to know. Then I'm closing this because changing binary path in config solves the problem.

from phpstormprotocol.

Snowbaha avatar Snowbaha commented on June 5, 2024

Hello,
I did the change with
(replaced open\/ with open\/?)
match = /^phpstorm:\/\/open\/?\?(url=file:\/\/|file=)(.+)&line=(\d+)$/.exec(url),
in the run_editor.js

And I adapt the config.yml of Symfony 3 :
ide: 'phpstorm://open/?url=file://%%f&line=%%l'

it looks like:
wqdzno

But Now I have this error:
2xlwsn

Error : File is not found

Is it the same issue or another one?

from phpstormprotocol.

aik099 avatar aik099 commented on June 5, 2024

I don't know, I can't easily translate French text on the images 😉

from phpstormprotocol.

Snowbaha avatar Snowbaha commented on June 5, 2024

Oups sorry :
"Line : 55"
Char (not sure what it is?) : 2
Error : File is not found

But May I have to create new issue?

Here the full JS :

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.2.1',

	// 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: ''
};


// don't change anything below this line, unless you know what you're 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"';

if (match) {

	var	shell = new ActiveXObject('WScript.Shell'),
		file_system = new ActiveXObject('Scripting.FileSystemObject'),
		file = decodeURIComponent(match[2]).replace(/\+/g, ' '),
		search_path = file.replace(/\//g, '\\');

	if (settings.projects_basepath != '' && settings.projects_path_alias != '') {
		file = file.replace(new RegExp('^' + settings.projects_basepath), settings.projects_path_alias);
	}

	while (search_path.lastIndexOf('\\') != -1) {
		search_path = search_path.substring(0, search_path.lastIndexOf('\\'));

		if(file_system.FileExists(search_path+'\\.idea\\.name')) {
			project = search_path;
			break;
		}
	}

	if (project != '') {
		editor += ' "%project%"';
	}

	editor += ' --line %line% "%file%"';

	var command = editor.replace(/%line%/g, match[3])
						.replace(/%file%/g, file)
						.replace(/%project%/g, project)
						.replace(/\//g, '\\');

	shell.Exec(command);
	shell.AppActivate(settings.window_title);
}

from phpstormprotocol.

aik099 avatar aik099 commented on June 5, 2024

I have no idea. Probably something in regexp needs to be escaped differently.

from phpstormprotocol.

Snowbaha avatar Snowbaha commented on June 5, 2024

Ok not easy to find indeed :(

from phpstormprotocol.

buddh4 avatar buddh4 commented on June 5, 2024

Perhaps you have to align the editor path. Try setting the path directly

editor = "<path to my phpstorm.exe>";

instead of

editor = '"C:\\' + (settings.x64 ? 'Program Files (x86)' : 'Program Files') + '\\JetBrains\\' + settings.folder_name + '\\bin\\phpstorm.exe"';

from phpstormprotocol.

Snowbaha avatar Snowbaha commented on June 5, 2024

Ohhh nice ! It is working ^^
Thanks !

editor = '"C:\\Program Files (x86)\\JetBrains\\' + settings.folder_name + '\\bin\\phpstorm.exe"';

from phpstormprotocol.

aik099 avatar aik099 commented on June 5, 2024

@Snowbaha , were you able to fix the regexp and ready to send a PR?

from phpstormprotocol.

Snowbaha avatar Snowbaha commented on June 5, 2024

Ok i will Try, I found the right editor path ^^ the x64 was inversed

from phpstormprotocol.

Related Issues (20)

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.