Skip to content

Commit

Permalink
docs: improve docs for Magika deps
Browse files Browse the repository at this point in the history
Signed-off-by: Jack Cherng <[email protected]>
  • Loading branch information
jfcherng committed Feb 26, 2024
1 parent 79dc78a commit b55a67b
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 3.1.0

- feat: configurable debounce time via `debound` setting
- feat: configurable debounce time via `debounce` setting

## 3.0.2

Expand Down
1 change: 1 addition & 0 deletions docs/src/_snippets/links.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
[pc-lsp-json]: https://packagecontrol.io/packages/LSP-json
[pc-lsp]: https://packagecontrol.io/packages/LSP
[plugin-constraints-dir]: https://github.com/jfcherng-sublime/ST-AutoSetSyntax/tree/st4/plugin/rules/constraints
[plugin-dependencies-dir]: https://github.com/jfcherng-sublime/ST-AutoSetSyntax/tree/dependencies
[plugin-matches-dir]: https://github.com/jfcherng-sublime/ST-AutoSetSyntax/tree/st4/plugin/rules/matches
[python-regex-flags]: https://docs.python.org/3.8/library/re.html#re.A
[python-regex-inline-flags]: https://docs.python.org/3.8/library/re.html#index-16
Expand Down
40 changes: 38 additions & 2 deletions docs/src/experimental/dl-based-syntax-detection.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,50 @@ It uses Google's [Magika](https://github.com/google/magika) library to detect th
1. Install dependencies.

Run `AutoSetSyntax: Download Dependencies` from the command palette.
The dependencies can be up to 50 MB in size, so it may take a while.
The dependencies can be up to \~50 MB in size, so it may take a while.
When it's done, there will be a popup dialogue.

!!! tip "If your machine have no access to GitHub..."

You can download the dependencies on [GitHub][plugin-dependencies-dir]
basing on your machine's OS and CPU architecture by any means.
If you don't know which one to download, run the following command in Sublime Text's console:

```python
import AutoSetSyntax; AutoSetSyntax.plugin.constants.PLUGIN_PY_LIBS_URL
```
Decompress the downloaded ZIP file into `Package Storage/AutoSetSyntax/`
so that the directory structure looks like the following:

```text
Package Storage
└─ AutoSetSyntax
└─ libs-py38@linux_x64
├── click
├── click-8.1.7.dist-info
├── colorama
├── colorama-0.4.6.dist-info
├── coloredlogs
├── coloredlogs.pth
├── coloredlogs-15.0.1.dist-info
...
```

You can open `Package Storage/AutoSetSyntax/` directory by running
the following Python code in Sublime Text's console:

```python
import AutoSetSyntax; (d := AutoSetSyntax.plugin.constants.PLUGIN_STORAGE_DIR).mkdir(parents=True, exist_ok=True); window.run_command("open_dir", {"dir": str(d)})
```

1. Enable the feature.

Set `"magika.enabled"` to `true` in AutoSetSyntax's settings.

After you've done all steps above, it should just work without restarting Sublime Text.
After finishing all steps above, it should just work without restarting Sublime Text.
You may go [here](https://doc.rust-lang.org/rust-by-example/hello.html) to copy some Rust codes
and paste them into Sublime Text to test whether this feature works.

## Demo

Expand Down

0 comments on commit b55a67b

Please sign in to comment.