After installation, go to Plugins - NppExec - Execute NppExec Script...
3. Into menu, paste the next code (under the spoiler):
```
NPP_CONSOLE - //hide the log output
npe_console p- //hide the ==== READY ==== message in the end
npp_save //save the file, so linter will lint the actual edited file, and not its original, unedited copy
cmd /C //actual linting - call cmd, /C so it will close the cmd in the end
NPP_CONSOLE + //turn back the log output, so if linter will show any error, user will see the error message
C:\Games\cddaDev\json_formatter.exe $(FULL_CURRENT_PATH) // !!! first part is what you should edit manually,
// just paste the path into your json_formatter.exe
// $(FULL_CURRENT_PATH) respond to tell the linter which file (this one) to lint
NPP_CONSOLE - //turning log off again
set var_exitcode=$(EXITCODE) //save the exit code
set var1=$(FULL_CURRENT_PATH) //save the path to the file, so we can reload it
npp_close $(var1) //awful way to reload file by closing and opening it again
npp_open $(var1) //because the only another way is to change the tab, and its worse
unset var1
if $(var_exitcode)==0 goto exit_console //if exit code 0, it means everything is good
goto print_console //else we left the console open
:exit_console
npp_console off
exit
:print_console
npp_console on
```
In this code, replace C:\Games\cdda\json_formatter.exe with your own path to json_formatter.exe file
Press Save…, and rename it like you want (like Lint the file)
Exit the menu
Go to Plugins - NppExec and activate Follow $(CURRENT_DIRECTORY)
Go to Plugins - NppExec - Advanced Options
8.1 Change Visible (on start) to be No
From Associated Script menu, pick your script, give him some name, and add it
9.1 Restart the Notepad
Go to Settings - Shortcut Mapper
In Plugin commands, find your script, and give him some proper shortcut
Go to Plugins - NppExec - Console Output Filters…
Go to Highlight menu, and add *Json error* text into the proper field, press the first checkbox, and write FF into the Red field
Done! Now pressing the shortcut will save, lint, and reload the file. If there would be some error, linter will show the error message similar to the in game one, with string number, where the error occur
Additional context
I still think it's possible to make the code point the user toward the place where the error occur, but my brain is too smooth to make it
Note: one can go to Settings - Preferences - MISC, and pick "update silently", it'll remove "the file has been modified by another program" popup, and your files would be updated automatically.
This version is deprecated, see #16
Solution you would like.
NppExec
addon from Plugin AdminPlugins
-NppExec
-Execute NppExec Script...
3. Into menu, paste the next code (under the spoiler):
``` NPP_CONSOLE - //hide the log output npe_console p- //hide the ==== READY ==== message in the end npp_save //save the file, so linter will lint the actual edited file, and not its original, unedited copy cmd /C //actual linting - call cmd, /C so it will close the cmd in the end NPP_CONSOLE + //turn back the log output, so if linter will show any error, user will see the error message C:\Games\cddaDev\json_formatter.exe $(FULL_CURRENT_PATH) // !!! first part is what you should edit manually, // just paste the path into your json_formatter.exe // $(FULL_CURRENT_PATH) respond to tell the linter which file (this one) to lint NPP_CONSOLE - //turning log off again set var_exitcode=$(EXITCODE) //save the exit code set var1=$(FULL_CURRENT_PATH) //save the path to the file, so we can reload it npp_close $(var1) //awful way to reload file by closing and opening it again npp_open $(var1) //because the only another way is to change the tab, and its worse unset var1 if $(var_exitcode)==0 goto exit_console //if exit code 0, it means everything is good goto print_console //else we left the console open :exit_console npp_console off exit :print_console npp_console on ```C:\Games\cdda\json_formatter.exe
with your own path tojson_formatter.exe
fileSave…
, and rename it like you want (likeLint the file
)Plugins
-NppExec
and activateFollow $(CURRENT_DIRECTORY)
Plugins
-NppExec
-Advanced Options
8.1 ChangeVisible (on start)
to beNo
Associated Script
menu, pick your script, give him some name, and add it 9.1 Restart the NotepadSettings
-Shortcut Mapper
Plugin commands
, find your script, and give him some proper shortcutPlugins
-NppExec
-Console Output Filters…
Highlight
menu, and add*Json error*
text into the proper field, press the first checkbox, and writeFF
into theRed
fieldDone! Now pressing the shortcut will save, lint, and reload the file. If there would be some error, linter will show the error message similar to the in game one, with string number, where the error occur
Additional context
I still think it's possible to make the code point the user toward the place where the error occur, but my brain is too smooth to make it
Note: one can go to Settings - Preferences - MISC, and pick "update silently", it'll remove "the file has been modified by another program" popup, and your files would be updated automatically.