Skip to content

Commit

Permalink
Merge pull request dylan-lang#33 from cgay/dev
Browse files Browse the repository at this point in the history
Better project finding / opening
  • Loading branch information
cgay authored Apr 19, 2024
2 parents 50ae933 + be9ea31 commit bbb365f
Show file tree
Hide file tree
Showing 40 changed files with 687 additions and 668 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: build-and-test

on:
push:
# all branches
paths-ignore:
- 'documentation/**'
pull_request:
branches:
- main
- master
paths-ignore:
- 'documentation/**'

# This enables the Run Workflow button on the Actions tab.
workflow_dispatch:

jobs:
build-and-test:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]

steps:
- uses: actions/checkout@v4

- name: Install Open Dylan
uses: dylan-lang/install-opendylan@v3
with:
version: 2024.1
tag: v2024.1.0

- name: Install dependencies
run: dylan update

- name: Build test suite
run: dylan build lsp-dylan-test-suite

- name: Run test suite
run: |
_build/bin/lsp-dylan-test-suite --report surefire --report-file _build/lsp-dylan-tests.xml
- name: Publish Test Report
if: success() || failure()
uses: mikepenz/action-junit-report@v4
with:
report_paths: '**/_build/*-tests.xml'
detailed_summary: true
include_passed: true
18 changes: 0 additions & 18 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
[submodule "vscode-dylan"]
path = vscode-dylan
url = https://github.com/dylan-lang/vscode-dylan.git
[submodule "ext/json"]
path = ext/json
url = https://github.com/dylan-lang/json
[submodule "ext/uncommon-dylan"]
path = ext/uncommon-dylan
url = https://github.com/cgay/uncommon-dylan
[submodule "ext/pacman"]
path = ext/pacman
url = https://github.com/dylan-lang/pacman
[submodule "ext/command-line-parser"]
path = ext/command-line-parser
url = https://github.com/dylan-lang/command-line-parser
[submodule "ext/logging"]
path = ext/logging
url = https://github.com/dylan-lang/logging
[submodule "ext/dylan-tool"]
path = ext/dylan-tool
url = https://github.com/dylan-lang/dylan-tool
24 changes: 14 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,24 @@ DYLAN ?= $${HOME}/dylan
install_bin = $(DYLAN)/bin
app_name = dylan-lsp-server

build: *.dylan
dylan-compiler -build -unify $(app_name)
build: sources/*.dylan sources/lsp-dylan.lid sources/server.lid
dylan build --unify $(app_name)

install: build
mkdir -p $(install_bin)
cp _build/sbin/$(app_name) $(install_bin)/
if [[ -d "_build" ]]; then \
cp _build/sbin/$(app_name) $(install_bin)/; \
else \
cp ../_build/sbin/$(app_name) $(install_bin)/; \
fi

install-debug: build
mkdir -p $(install_bin)
cp _build/sbin/$(app_name).dbg $(install_bin)/$(app_name)

test: build
dylan-compiler -build lsp-dylan-test-suite
_build/bin/lsp-dylan-test-suite
test: sources/*-tests.dylan sources/test-suite*.dylan sources/test-suite.lid
dylan build lsp-dylan-test-suite
if [[ -d "_build" ]]; then \
_build/bin/lsp-dylan-test-suite ; \
else \
../_build/bin/lsp-dylan-test-suite ; \
fi

clean:
rm -rf _build
Expand Down
41 changes: 14 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,45 +15,32 @@ As of 2022-11-07, the server implements
* Hover (i.e., argument lists)

When applied to a symbol which is bound to a generic function, "jump to
definition" will show a clickable list containing the generic function and
its specific methods, whereas "jump to declaration" will jump straight to
the generic function.
definition" will show a list containing the generic function and its specific
methods, whereas "jump to declaration" will jump straight to the generic
function.

We are currently using version [3.15 of the LSP protocol](https://microsoft.github.io/language-server-protocol/specifications/specification-3-15/).
We are currently using version [3.15 of the LSP
protocol](https://microsoft.github.io/language-server-protocol/specifications/specification-3-15/).


## Opening Projects

The LSP server needs to be able to open a project (that is, a Dylan library)
associated with the file you're editing when you turn on LSP in your editor. It
makes two attempts, in the following order:
assumes you are using a [dylan-tool](https://github.com/dylan-lang/dylan-tool)
workspace and searches for a project to open as follows:

1. Search up in the directory structure until it finds a `workspace.json` file,
which indicates a [dylan-tool](https://github.com/dylan-lang/dylan-tool)
workspace. In this case it looks for the "default-library" setting in the
workspace file and opens that library. If there is no default library set
and there is only one "active" library, it uses that. Otherwise it fails.
1. If there is a `workspace.json` file and that file has a `"default-library"`
property, the specified library is opened.

2. Search up in the directory structure for a `registry` directory and open the
library associated with the first `*.lid` file it finds there. (Note that it
currently removes the `.lid` suffix and assumes that a library by the same
name as the basename of the file can be opened via the registry. This should
eventually be fixed.)
2. It uses `dylan-tool` to choose a library defined in the workspace. This is
[generally](https://github.com/dylan-lang/dylan-tool/blob/292b7bf761745c9fa810511c9888f802dd787011/sources/workspaces/workspaces.dylan#L151)
the test suite library, if one exists.

Normally you shouldn't need to set any environment variables; everything is
derived from the full pathname to the `dylan-compiler` executable, which must
be on your `PATH`.

However, sometimes you may be working on several libraries at once and they're
not all listed in the registry found as described above. In that case, add all
the relevant registry directories to `OPEN_DYLAN_USER_REGISTRIES`. For example:

export OPEN_DYLAN_USER_REGISTRIES=/project1/registry:/project2/registry

See [Using Source
Registries](https://opendylan.org/documentation/getting-started-cli/source-registries.html)
for more.

## Emacs Usage

1. Make sure the `dylan-lsp-server` executable is on your `PATH`, or customize
Expand Down Expand Up @@ -81,8 +68,8 @@ for more.
The client starts the LSP server (the `dylan-lsp-server` executable) and
connects to it.

The emacs client has a customization group "Lsp Dylan" which is a member of the
"Programming / Tools" group, and has the following variables:
The emacs client has a customization group "lsp-dylan" which is a member of the
"Language Server (lsp-mode)" group, and has the following variables:

* `lsp-dylan-exe-pathname`
* `lsp-dylan-extra-command-line-options`
Expand Down
162 changes: 0 additions & 162 deletions compiler.dylan

This file was deleted.

6 changes: 4 additions & 2 deletions dylan-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
"version": "0.2.0",
"dependencies": [
"command-line-parser@3.1",
"dylan-tool@0.11.1",
"json@1.0",
"logging@2.1",
"vscode-dylan@0.1",
"uncommon-dylan@0.2",
],
"dev-dependencies": [
"testworks"
"testworks",
"vscode-dylan"
],
"url": "https://github.com/dylan-lang/lsp-dylan"
}
1 change: 0 additions & 1 deletion ext/command-line-parser
Submodule command-line-parser deleted from 738fc8
1 change: 0 additions & 1 deletion ext/dylan-tool
Submodule dylan-tool deleted from fee6d8
1 change: 0 additions & 1 deletion ext/json
Submodule json deleted from 91c417
1 change: 0 additions & 1 deletion ext/logging
Submodule logging deleted from 46a875
1 change: 0 additions & 1 deletion ext/pacman
Submodule pacman deleted from a72fc0
1 change: 0 additions & 1 deletion ext/uncommon-dylan
Submodule uncommon-dylan deleted from 06eddc
Loading

0 comments on commit bbb365f

Please sign in to comment.