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

Docs: Installation #229

Merged
merged 3 commits into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ fix typos, warnings, unused variables and a whole host of errors when they occur
faster.

## Installation
To install lexical fetch the source code from git, then do the following:

Follow the [Detailed Installation Instructions](pages/installation.md)

```
make release.namespaced
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defmodule Lexical.RemoteControl.Plugin.Discovery do
If a plugin is found, the app is then registered with the plugin system.

If we're running in a namespaced build, we must apply the same namespace to the plugin's modules, or it
will be looking for structs like `Lexical.Document', and be passed in structs like `LXRelease.Document`,
will be looking for structs like `Lexical.Document`, and be passed in structs like `LXRelease.Document`,
and the plugin will crash.
"""
alias Lexical.Plugin
Expand Down
8 changes: 6 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@ defmodule Lexical.LanguageServer.MixProject do

defp docs do
[
main: "Lexical",
main: "readme",
deps: [jason: "https://hexdocs.pm/jason/Jason.html"],
extras: ~w(README.md pages/architecture.md),
extras: ~w(
README.md
pages/installation.md
pages/architecture.md
),
filter_modules: fn mod_name, _ ->
case Module.split(mod_name) do
["Lexical", "Protocol", "Requests" | _] -> true
Expand Down
93 changes: 93 additions & 0 deletions pages/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Installation

The following instructions document how to install Lexical after
building from source. Some editors, like Visual Studio Code, have the
ability to automatically install the latest version of Lexical for
you.

## Caveats

* Presently, Lexical only works on Elixir 1.14 under Erlang 25. Our
aim in the near future is to support Elixir 1.13 to 1.15 and erlang
versions >= 24. Pull requests gladly accepted.

* While it's within Lexical's capabilities to run your project in a
different elixir and erlang version than Lexical is built with,
presently, we don't support running your project in a different
elixir and or erlang version. We aim to fix this very shortly, as
this dramatically limits Lexical's usefulness when working with
multiple projects.


## Prerequisites

The first step in getting Lexical running locally is to clone the git
repository. Do this with

```elixir
git clone [email protected]:lexical-lsp/lexical.git
```

Then change to the lexical directory
```shell
cd lexical
```
...and build the project

```shell
make release.namespaced
```

If things complete successfully, you will then have a release in your
`build/dev/rel/lexical` directory. If you see errors, please file a
bug.

For the following examples, assume the absolute path to your Lexical
source code is `/my/home/projects/lexical`.

## Editor-specific setup
1. [Vanilla Emacs with lsp-mode](#vanilla-emacs-with-lsp-mode)
2. [Vanilla Emacs with eglot](#vanilla-emacs-with-eglot)
3. [Visual Studio Code](#visual-studio-code)

## Vanilla Emacs with lsp-mode
The emacs instructions assume you're using `use-package`, which you
really should be. In your `.emacs.d/init.el` (or wherever you put your
emacs configuration), insert the following code:

```lisp
(use-package lsp-mode
:ensure t
:config
(setq lsp-modeline-code-actions-segments '(count icon name))

:init
'(lsp-mode))


(use-package elixir-mode
:ensure t
:custom
(lsp-elixir-server-command '("/my/home/projects/_build/dev/rel/lexical/start_lexical.sh")))

```

Restart emacs, and Lexical should start when you open a file with a
`.ex` extension.


## Vanilla Emacs with eglot

Eglot has a couple of utf8 related bugs that make it fail with
Lexical, and is not supported at this time.


## Visual Studio Code

Click on the extensions button on the sidebar, then search for
`lexical`, then click `install`. By default, the extension will automatically
download the latest version of Lexical.

To change to a local executable, go to `Settings -> Extensions -> Lexical` and
type `/my/home/projects/lexical/_build/dev/rel/lexical` into the text box in
the `Server: Release path override` section.