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

use forward slashes in TableFormatter to make paths clickable #1017

Closed
wants to merge 1 commit into from

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Feb 14, 2022

closes phpstan/phpstan#6483

using forward slashes in e.g. Git Bash for windows to make the links clickable.
I tested it on gitbash for windows. with this patch I can hold CTRL key and click file-paths - even without configuring editorUrl.

grafik

@@ -49,6 +49,10 @@ public function absolutizePath(string $path): string
return rtrim($this->getWorkingDirectory(), '/\\') . DIRECTORY_SEPARATOR . ltrim($path, '/\\');
}

public function forwardSlashes(string $originalPath) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this could be tagged @api

@staabm
Copy link
Contributor Author

staabm commented Feb 14, 2022

just submitted the suggested fix of @paranoiq .. In case you would accept this patch, I can add test-coverage.

@ondrejmirtes
Copy link
Member

It feels really weird to me to make forward slashes for Windows users. Can you please check that configuring editorUrl works even with backslashes? I'd rather have Windows users configure editorUrl instead of doing this hack for them.

@ondrejmirtes
Copy link
Member

Please test the latest release on Windows and see if editorUrl now works better, thanks. If not, please open an issue.

@staabm staabm deleted the forward-slashes branch March 21, 2022 12:37
@paranoiq
Copy link
Sponsor Contributor

paranoiq commented Mar 23, 2022

"It feels really weird to me to make forward slashes for Windows users." - and who are those Windows users exactly? these is no sole Windows user working alone in the woods with Windows only configuration. we usually work in teams with more than one OS involved on dev machines. CI is usually running on Linux. tools are already configured with paths with forward slashes to make them work on Linux/Mac machines as well as Windows, which has no problem with forward slashes. in the end on Windows resulting full paths in PHPStan output are then composed by both forward and back slashes

this falls in the same category as line ending conversions in git. in the beginning there was a good intent of protecting Windows users with inferior text editors, after years it is just pain in the butt for almost every new Windows user

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants