Skip to content

Commit

Permalink
Merge pull request #13 from junk1tm/master
Browse files Browse the repository at this point in the history
Install a platform-dependent ltex-ls release if JAVA_HOME is not set
  • Loading branch information
LDAP authored Aug 23, 2022
2 parents babcc48 + 744072c commit 30b6c2e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Latex/Markdown grammar check support for Sublime's LSP plugin provided through [

## Installation

1. Install [LSP](https://packagecontrol.io/packages/LSP) via Package Control. Make sure a x64-version of `java` is in path and `JAVA_HOME` is set.
1. Install [LSP](https://packagecontrol.io/packages/LSP) via Package Control. If you prefer to install [valentjn/ltex-ls](https://github.com/valentjn/ltex-ls) without `java` bundled, make sure a x64-version is in path and `JAVA_HOME` is set.
2. Install this plugin.
3. Restart Sublime.

Expand Down
2 changes: 1 addition & 1 deletion messages/install.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ https://github.com/valentjn/ltex-ls.
# Installation

- Make sure [LSP](https://packagecontrol.io/packages/LSP) is installed.
- Make sure `java` is in path and `JAVA_HOME` is set.
- If you prefer to install [valentjn/ltex-ls](https://github.com/valentjn/ltex-ls) without `java` bundled, make sure it is in path and `JAVA_HOME` is set.


# Language
Expand Down
15 changes: 13 additions & 2 deletions plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


GITHUB_DL_URL = 'https://github.com/valentjn/ltex-ls/releases/download/'\
+ '{0}/ltex-ls-{0}.tar.gz' # Format with Release-Tag
+ '{0}/ltex-ls-{0}{1}' # Format with Release-Tag
GITHUB_RELEASES_API_URL = 'https://api.github.com/repos/valentjn/ltex-'\
+ 'ls/releases/latest'
SERVER_FOLDER_NAME = 'ltex-ls-{}' # Format with Release-Tag
Expand Down Expand Up @@ -204,7 +204,18 @@ def install_or_update(cls) -> None:
os.makedirs(cls.basedir())
with tempfile.TemporaryDirectory() as tempdir:
tar_path = os.path.join(tempdir, 'server.tar.gz')
download_file(GITHUB_DL_URL.format(cls.serverversion()),

suffix = ".tar.gz" # platform-independent release
if os.getenv("JAVA_HOME") is None:
p = sublime.platform()
if p == "osx":
suffix = "-mac-x64.tar.gz"
elif p == "linux":
suffix = "-linux-x64.tar.gz"
elif p == "windows":
suffix = "-windows-x64.zip"

download_file(GITHUB_DL_URL.format(cls.serverversion(), suffix),
tar_path,
show_download_progress)
sublime.status_message('ltex-ls: extracting')
Expand Down

0 comments on commit 30b6c2e

Please sign in to comment.