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

Can't add external handler program #1098

Closed
internationils opened this issue Mar 21, 2024 · 6 comments
Closed

Can't add external handler program #1098

internationils opened this issue Mar 21, 2024 · 6 comments
Assignees
Labels

Comments

@internationils
Copy link

I've tried adding notepad++ both through tools->settings as specified in https://markdownmonster.west-wind.com/docs/_6if1ephjm.htm and also through right clicking on a file and Open ... -> Edit External programs. I get taken to the line

"ExternalPrograms": [],

and then edit it to

  "ExternalPrograms": [
  {
    "Name": "Open in Notepad++",
    "Executable": "C:\Program Files\Notepad++\notepad++.exe",
    "Args": "{0}",
    "Extensions": "TEXT"
  }
  ],

...but when saving and closing, then reopening it reverts to the intial [] state. After noticing that I need double backslashes "\\" I tried that and it saved it and expanded it to

  "ExternalPrograms": [
    {
      "Name": "Open in Notepad++",
      "Executable": "C:\\Program Files\\Notepad++\\notepad++.exe",
      "Args": "{0}",
      "SaveBeforeActivation": false,
      "Extensions": "TEXT",
      "EditorKeyboardShortcut": null
    }
  ],

... so it saved, but didn't work.

It would be great to have a) an error message if the config is invalid (I was wondering why the initial version never got saved) and b) it still doesn't work, i.e. nothing shows up:

image

@internationils
Copy link
Author

internationils commented Mar 21, 2024

Ah, figured something else out. It DOES work on .sh files (I guess those are TEXT?), it does not work on .m4 (preprocessor) files. Adding "m4": "m4", to the EditorExtensionMappings works and notepad++ is shown.

What's strange: I can click on the .m4 file to view and edit it in MM, but clicking on a .sh file (which is already listed in the mappings) does nothing in MM. Right-clicking and "Open in Editor" works though. Strange.

Edit: it DOES do something: clicking on a .sh file opened an Explorer window behind MM that I never saw (I had about 20 of them : ) ... why does a double click on a .sh file browse into the directory where a .m4 file opens in the editor?!?

Any chance you can clarify that in the documentation link above?

@RickStrahl
Copy link
Owner

It looks like there is a special case on .sh as an executable file that doesn't need to be set.

I've adjusted the logic so that it's treated like a text file as normal. You should now be able to single click to a see a preview in the editor then click in (or double click) to keep the file in the editor.

This should now work for all the extensions that are mapped - previously there was only some selected formats that were shown this way and you had to double click.

@RickStrahl
Copy link
Owner

I've also added an additional pre-save check when saving the JSON. If the JSON is invalid you will now see a status bar notification and the file state will stay as changed.

@RickStrahl
Copy link
Owner

So not clear whether the NotePad++ entry doesn't work or whether the issue was the file never really saved. You may have to restart after adding the external program before you can see it.

@RickStrahl
Copy link
Owner

Updates are in 3.2.9.3+

@RickStrahl
Copy link
Owner

So tried out setting up Notepad++ as an external program and it works fine now (probably did before too except for the saving issues most likely).

  "ExternalPrograms": [
    {
      "Name": "Open in Notepad++",
      "Executable": "C:\\Program Files\\Notepad++\\notepad++.exe",
      "Args": "\"{0}\"",
      "SaveBeforeActivation": true,
      "Extensions": "TEXT,FOLDER",
      "EditorKeyboardShortcut": "Alt-F9"
    },
  ]

image

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

No branches or pull requests

2 participants