| Summary: | External tool needs "Working directory" set to something to work | ||
|---|---|---|---|
| Product: | [Applications] kate | Reporter: | Maciej Libera <maciej.libera> |
| Component: | general | Assignee: | KWrite Developers <kwrite-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | minor | CC: | justin.zobel |
| Priority: | NOR | ||
| Version First Reported In: | 19.12.0 | ||
| Target Milestone: | --- | ||
| Platform: | Microsoft Windows | ||
| OS: | Microsoft Windows | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
I will have a look. Out of curiosity, what other external tools do you use? PS: many of the other external tools may also not work in Windows, since I only tested on Linux for now. That's why feedback would be great. Git commit df2b580f1d6f28bdc098e29428f9ccffff279dee by Dominik Haumann. Committed on 19/01/2020 at 10:59. Pushed by dhaumann into branch 'external-tools-bug-416320'. External tools: Correctly set the working directory The old implementation does not seem to work under Windows. M +3 -2 addons/externaltools/katetoolrunner.cpp https://invent.kde.org/kde/kate/commit/df2b580f1d6f28bdc098e29428f9ccffff279dee Git commit df2b580f1d6f28bdc098e29428f9ccffff279dee by Dominik Haumann. Committed on 19/01/2020 at 10:59. Pushed by scmsync into branch 'external-tools-bug-416320'. External tools: Correctly set the working directory The old implementation does not seem to work under Windows. M +3 -2 addons/externaltools/katetoolrunner.cpp https://commits.kde.org/kate/df2b580f1d6f28bdc098e29428f9ccffff279dee Currently pending merge request to hopefully address this issue: https://invent.kde.org/kde/kate/merge_requests/57 Could you please tell me what currently happens, if you start your command on new text buffer? I wonder what happens, since the file was never saved yet, and thus has no associated directory as well. It should work, though. That was quick :)
So for running on new text buffer, it works without workaround.
By default I only saw two git tools, which is understandable, because other use *nix tools.
I tried JSON and XML format. I kind of cheated, because I just used Windows Subsystem for Linux: changed "Executable" to 'wsl' and move old value of the field to the beginning of "Arguments". E.g. for JSON format this is:
Executable: wsl
Arguments: jq '.' %{Document:FileName}
This will of course work only if someone enable WSL and install some distro on it with required tools.
I also modified "Google Selected Text":
Executable: cmd
Arguments: /C start "" "https://www.google.com/search?q=%{Document:Selection:Text}"
Yes, there are empty "" - it means no command, so OS will choose default program.
Strange thing is that it breaks on '&'. So if you try to search for e.g. 'some text & some other stuff' it will search only for 'some text '. I do not know why or whether it is something with Kate, my configuration or Windows. That is why I did not reported a bug for this, but I can if you wish of course. Note, that spaces are not problematic which (I guess?) means the text is correctly put in "".
One thing to note is that Kate is converting text in %{Document:Text} to default Windows encoding, which, surprisingly, is not UTF-8. This is probably the right thing to do and something to keep in mind.
I discovered what is with '&' and "Google Selected Text", I reported a new bug with description: https://bugs.kde.org/show_bug.cgi?id=416509 Git commit c3839ccfd6325fbf7781559a4e7f73379313fc37 by Christoph Cullmann, on behalf of Dominik Haumann. Committed on 21/01/2020 at 06:24. Pushed by cullmann into branch 'master'. External tools: Correctly set the working directory The old implementation does not seem to work under Windows. M +4 -3 addons/externaltools/katetoolrunner.cpp https://invent.kde.org/kde/kate/commit/c3839ccfd6325fbf7781559a4e7f73379313fc37 Git commit c3839ccfd6325fbf7781559a4e7f73379313fc37 by Christoph Cullmann, on behalf of Dominik Haumann. Committed on 21/01/2020 at 06:24. Pushed by scmsync into branch 'master'. External tools: Correctly set the working directory The old implementation does not seem to work under Windows. M +4 -3 addons/externaltools/katetoolrunner.cpp https://commits.kde.org/kate/c3839ccfd6325fbf7781559a4e7f73379313fc37 After the above commits can you please test and confirm if this issue is still occurring or if this bug report can be marked as resolved. I'm setting status to "needsinfo" pending your response, please change back to "reported" or "resolved" when you respond, thanks. Sure, just tested and can confirm the issue is solved. Thanks |
SUMMARY Running external tool has no effect if "Working directory" field is empty in "External Tools"/"Edit Tool" dialog. STEPS TO REPRODUCE 1. Go to Tools -> External Tools -> Configure... 2. Select "Insert UUID" tool, click "Edit..." 3. Note, that "Working directory" field is empty 4. Change "Executable" to: cmd 5. Change "Arguments" to: /c echo %{UUID} 6. Confirm 7. Try to use the tool OBSERVED RESULT Nothing happens EXPECTED RESULT The UUID is inserted at cursor position WORKAROUND 1. Edit tool again 2. Put something in "Working directory" field, I tried '%{Document:Path}' and a dot '.', both worked SOFTWARE/OS VERSIONS Windows: 10, 19H1 (1903), build 18362 Kate: apart from 19.12.0 I also tried Nightly, 20.03.70, build 698 from https://binary-factory.kde.org/job/Kate_Nightly_win64/ ADDITIONAL INFORMATION