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

Added support to Sublime Text with .lua files #55

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 49 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,55 @@ such as NeoVim, Atom, etc.
I don't have any experience setting up language extensions for platforms other than VSCode, so currently
looking for help with that. See tips and support thread on the issue for various editors:
- [Neovim](https://github.com/japhib/pico8-ls/issues/34)
- [Sublime Text](https://github.com/japhib/pico8-ls/issues/44)

### Sublime Text

Instructions for running pico8-ls with Sublime Text. **Warning:** these instructions are valid only if you use ```.lua ``` files for your code. If you want to edit directly a ```.p8``` file the following instructions will not work, and it is better to look for an alternative such as the package [https://github.com/wh0am1-dev/sublime-PICO-8](https://github.com/wh0am1-dev/sublime-PICO-8).

1. Clone the repo

```
git clone https://github.com/japhib/pico8-ls
```

2. Go to ```pico8-ls/server``` folder and install the ```npm``` dependencies.

```
cd pico8-ls
cd server
npm install
```

3. Compile the app to a binary:

```
npm run compile
```

4. Make a script to launch the server, and put it on somewhere in your *$PATH*:

```
echo -e '#!/usr/bin/env bash\n'"node $PWD/out/server.js" '"$@"' > ~/.local/bin/pico8-ls
chmod +x ~/.local/bin/pico8-ls
```

Now, in Sublime text, make sure you have the package [https://github.com/sublimelsp/LSP/](https://github.com/sublimelsp/LSP/) installed.

In ST go to *Preferences-> Package Settings-> LSP-> Settings*, and add this code to your settings:

```json
"clients":
{
"pico8-lua": {
"enabled": true,
"command": ["pico8-ls","--stdio"],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of making a new executable file like above, wouldn't it be simpler to have this command point to the right place?

Does Sublime Text not have any way to install a plugin? are all language servers this janky to install?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,

in sublime text there is a plugin called LSP that manages the lsp servers. In the docs appears:

A subprocess is always started. There is no support for connecting to a remote language server.

You can use tcp instead stdio to communicate with the server, but I don't know if that would be a better solution.

"selector": "source.lua",
},
}
```


Some of this information is taken from this thread: [https://github.com/japhib/pico8-ls/issues/44](https://github.com/japhib/pico8-ls/issues/44)

## Changelog

Expand Down
Loading