Skip to content

feature_request(option): print debugging information #46

@Kristinita

Description

@Kristinita

1. Summary

If users have problems with languagetool-sublime, debugging information could be helpful for them. Adding it could be a nice idea.

2. Argumentation of the need for the feature

2.1. Debugging information is helpful

Possibly, the existence of debugging information is always better than its non-existence.

Identifying problems without it may not be easy, especially for non-programmers and inexperienced programmers. LanguageTool is a prose grammar checker, and programming skills aren’t required to use it.

2.2. The practical example — additional java

I opened in Sublime Text a file for checking → Ctrl+Shift+PLanguage Tool: Start Local ServerCtrl+Shift+PLanguage Tool: Check Text (Local Server) → nothing was happening. Currently, languagetool-sublime doesn’t provide any debugging information.

I needed to analyze the code of languagetool-sublime. I launched from my terminal the command from the value of the cmd variable in the file LanguageTool.py:

D:\SashaDebugging\KiraLanguageTool>java -cp "D:/Chocolatey/tools/languagetool/languagetool-server.jar" org.languagetool.server.HTTPServer --port 8081
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/languagetool/server/HTTPServer has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:621)

I got the helpful error message, it means that my Java version is outdated. (It turned out that one of my programs requires Java 8. When I launched the command java, I launched this Java 8, not Java 25 installed on my machine. For this reason, I created the pull request #44.)

At first, I couldn’t understand how I needed to debug. If I had seen the output of the subprocess, I would have spent less time on debugging.

3. The example of desired behavior

3.1. Handling LanguageTool’s output

A user will add the option debug with the boolean value true to the file LanguageTool.sublime-settings:

{

	"debug": true,

	// Other settings

}

A user will open a file in Sublime Text → Ctrl+Shift+PLanguage Tool: Start Local Server → languagetool-sublime will catch stderr and stdout of the LanguageTool output and will redirect them to the Sublime Text console. Desired output for the example above:

[DEBUG] languagetool-sublime launches LanguageTool local server:
[DEBUG] java -cp "D:/Chocolatey/tools/languagetool/languagetool-server.jar" org.languagetool.server.HTTPServer --port 8081
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/languagetool/server/HTTPServer has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:621)

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions