Skip to content

Commit f607544

Browse files
authored
Merge pull request #11 from luttje/docs/simplify-installation-lls
Docs/simplify installation lls
2 parents da6c819 + d4f8722 commit f607544

File tree

7 files changed

+146
-45
lines changed

7 files changed

+146
-45
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
6363
## 📝 Attached Archives
6464
With this release the following archives are attached:
65-
- `*.lua.zip`: EmmyLua definitions
65+
- `*.lua.zip`: Annotations for Lua definitions to include in your workspace (e.g: for EmmyLua)
6666
- `*.json.zip`: JSON definitions based on the Wiki contents (can be used for further processing)
6767
6868
## 📚 Lua Language Server Addon

CONTRIBUTING.md

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# Contributing guide <!-- omit in toc -->
2+
3+
Thank you for investing your time in contributing to our project! With your contribution you help Garry's Mod Lua developers get accurate and the latest autocomplete suggestions for the GLua API.
4+
5+
In this guide you will get an overview of the contribution workflow from opening an issue, creating a PR, reviewing, and merging the PR.
6+
7+
## New contributor guide
8+
9+
To get an overview of the project, read the [README](README.md). Here are some general resources to help you get started with open source contributions:
10+
11+
* [Finding ways to contribute to open source on GitHub](https://docs.github.com/en/get-started/exploring-projects-on-github/finding-ways-to-contribute-to-open-source-on-github)
12+
* [Set up Git](https://docs.github.com/en/get-started/quickstart/set-up-git)
13+
* [GitHub flow](https://docs.github.com/en/get-started/quickstart/github-flow)
14+
* [Collaborating with pull requests](https://docs.github.com/en/github/collaborating-with-pull-requests)
15+
16+
17+
## Getting started
18+
19+
This project automatically builds Garry's Mod Lua API [annotations for use with `LuaLS/lua-language-server`](https://github.com/LuaLS/lua-language-server/wiki/Annotations). It does this by scraping [the Garry's Mod Wiki](https://wiki.facepunch.com/gmod/).
20+
21+
The above means that if you want to improve or correct the definitions, you'll have to either:
22+
23+
* [Contribute to the official Garry's Mod Wiki](https://wiki.facepunch.com/gmod/#contributing) (if it contains an error) and wait until the scraper runs again (at the start of every month).
24+
* Or, if there's an error in the scraper, you can [contribute to this project](#contributing-to-this-project) and fix it yourself.
25+
26+
The addon for Lua Language Server is seperate from this project. If you want it to be updated, you'll have to [contribute to that project according to these instructions](#updating-the-addon-for-lua-language-server).
27+
28+
## Contributing to this project
29+
30+
### Reporting an issue
31+
32+
If you find an error in the scraper, please [open an issue](https://github.com/luttje/glua-api-snippets/issues/new) and describe the problem. If you can, please include a link to the page on the Garry's Mod Wiki that is incorrectly scraped.
33+
34+
### Creating a pull request
35+
36+
You can help the project even more by fixing the error yourself. To do this, you'll have to [fork this project](https://docs.github.com/en/get-started/quickstart/fork-a-repo), make corrections and [create a pull request](https://github.com/luttje/glua-api-snippets/compare) with your changes. Before you do that, please consider the following:
37+
38+
* Create an issue before you start working on a pull request. This way you can get feedback on your idea before you spend time on it.
39+
* Make your changes on a seperate branch and name it according to this convention:
40+
* `bugfix/<short-bug-description>` if you're fixing a bug *(e.g. `bugfix/incorrect-argument-type`)*.
41+
* `feature/<short-feature-description>` if you're adding a new feature *(e.g. `feature/add-example-links`)*.
42+
* `docs/<short-docs-description>` if you're updating the documentation *(e.g. `docs/update-contributing-guide`)*.
43+
* Cluster changes in small commits. *This makes it easier to review your changes.*
44+
* Do not create a single PR with multiple unrelated changes. Create seperate PRs for each change. *This makes it easier to review your changes.*
45+
* Make sure your changes are correct and don't break anything.
46+
* Add tests for your changes if possible.
47+
* Clearly describe your changes (and why you made them) in the pull request description.
48+
49+
#### Step-by-step guide to contribute to this project
50+
51+
1. [Fork this project](https://github.com/luttje/glua-api-snippets/fork) to your own GitHub account.
52+
53+
2. [Clone the forked project](https://docs.github.com/en/get-started/quickstart/fork-a-repo#cloning-your-forked-repository) to your local machine.
54+
55+
3. Create a new branch for your changes, for example:
56+
57+
```bash
58+
git checkout -b bugfix/incorrect-argument-type
59+
```
60+
61+
4. Make your changes and commit them:
62+
63+
```bash
64+
git add .
65+
git commit -m "Fix incorrect argument type"
66+
```
67+
68+
5. Push your changes to your forked project:
69+
70+
```bash
71+
git push origin bugfix/incorrect-argument-type
72+
```
73+
74+
6. [Create a pull request](https://github.com/luttje/glua-api-snippets/compare) with your changes.
75+
76+
7. Wait for your pull request to be reviewed and merged.
77+
78+
**Thanks in advance for your contribution!**
79+
80+
## Updating the addon for Lua Language Server
81+
82+
At the first of every month the scraper runs and updates the addon for Lua Language Server to [the `lua-language-server-addon` branch in this repo](https://github.com/luttje/glua-api-snippets/tree/lua-language-server-addon). However this does not automatically update the Lua Language Server Addon, since the branch is only a sub repository in the [LuaLS/LLS-Addons repository](https://github.com/LuaLS/LLS-Addons)
83+
84+
#### Step-by-step guide to update our addon at [`LuaLS/LLS-Addons`](https://github.com/LuaLS/LLS-Addons/)
85+
86+
1. Go to the Lua Language Server Addons repository and take note of [their contribution guidelines](https://github.com/LuaLS/LLS-Addons/blob/main/CONTRIBUTING.md)
87+
88+
2. [Fork the Lua Language Server Addon Repository](https://github.com/LuaLS/LLS-Addons/fork) to your own GitHub account.
89+
90+
3. [Clone the forked project](https://docs.github.com/en/get-started/quickstart/fork-a-repo#cloning-your-forked-repository) to your local machine.
91+
92+
4. Create a new branch for your changes, for example:
93+
94+
```bash
95+
git checkout -b update-garrysmod-addon
96+
```
97+
98+
5. Update the `garrysmod` sub repository to the latest commit in the `lua-language-server-addon` branch in this repo:
99+
100+
```bash
101+
git submodule update --remote addons/garrysmod/module
102+
```
103+
104+
6. Commit your changes:
105+
106+
```bash
107+
git add .
108+
git commit -m "Updated garrysmod addon"
109+
```
110+
111+
7. Push your changes to your forked project:
112+
113+
```bash
114+
git push origin update-garrysmod-addon
115+
```
116+
117+
8. [Create a pull request at the `LuaLS/LLS-Addons` repository](https://github.com/LuaLS/LLS-Addons/compare) with your changes. Make sure to allow edits from maintainers.
118+
119+
9. Wait for your pull request to be reviewed and merged.
120+
121+
**Thanks in advance for your help in keeping our addon up to date!**

README.md

Lines changed: 19 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,44 @@
1-
# Garry's Mod Lua API Scraper
1+
# Garry's Mod Lua API Definitions
22

3+
[![GitHub Release](https://img.shields.io/github/v/release/luttje/glua-api-snippets)](https://github.com/luttje/glua-api-snippets/releases)
4+
[![GitHub License](https://img.shields.io/github/license/luttje/glua-api-snippets)](https://github.com/luttje/glua-api-snippets/blob/main/LICENSE)
35
[![GitHub Tests Action](https://github.com/luttje/glua-api-snippets/actions/workflows/tests.yml/badge.svg)](https://github.com/luttje/glua-api-snippets/actions/workflows/tests.yml)
46
[![Test Coverage Status](https://coveralls.io/repos/github/luttje/glua-api-snippets/badge.svg?branch=main)](https://coveralls.io/github/luttje/glua-api-snippets?branch=main)
57

6-
This repository scrapes the Garry's Mod Lua API and generates snippets that will help provide autocompletion for Lua in editors like VSCode, IntelliJ and more.
8+
This repository scrapes the Garry's Mod Lua API and generates snippets that will help provide autocompletion for Lua in editors like VSCode, NeoVim and more.
79

810
## 🔨 Usage
911

10-
*In the following instructions we'll use `myproject` as an example name of the project we're working on.*
12+
1. Install **Lua Language Server:** for your editor of choice:
13+
* [Visual Studio Code Extension](https://marketplace.visualstudio.com/items?itemName=sumneko.lua)
14+
* [NeoVim Configuration](https://github.com/LuaLS/lua-language-server#neovim)
15+
16+
2. Open the **Lua Language Server Addon Manager** with the key combination `Ctrl+Shift+P` (or `Cmd+Shift+P` on macOS) and search for *Addon*, then select **Lua: Open Addon Manager ...**:
17+
![VSCode editor command suggestion showing: Lua: Open Addon Manager ...](docs/lls-addon-manager-command.jpg)
1118

12-
1. Install one of these extensions for your editor of choice:
13-
* **Lua Language Server:** [VSCode Extension](https://marketplace.visualstudio.com/items?itemName=sumneko.lua) | [NeoVim Configuration](https://github.com/LuaLS/lua-language-server#neovim)
14-
* **EmmyLua:** [VSCode Extension](https://marketplace.visualstudio.com/items?itemName=tangzx.emmylua) | [IntelliJ Plugin](https://plugins.jetbrains.com/plugin/9768-emmylua)
19+
3. Search for the **Garry's Mod** addon and **Enable** it:
20+
![Lua Language Server Addon Manager showing the Garry's Mod addon](docs/lls-addon-manager-gmod.jpg)
1521

16-
2. Download the latest Lua release named something like `YYYY-MM-DD_HH-MM-SS.lua.zip` from [🔗 the releases page](https://github.com/luttje/glua-api-snippets/releases).
17-
18-
3. Extract the downloaded release to a directory on your computer. We'll use `~/glua-api-snippets` as an example.
19-
20-
4. The Language Server needs to be able to find the snippets in your project workspace. You can either:
21-
22-
<details>
23-
<summary>Add the directory to your editor workspace.</summary>
24-
25-
#### In VSCode
26-
Open the `myproject` project and add the directory to the workspace by clicking the `+` button in the bottom left corner of the editor.
27-
[*Learn more*](https://code.visualstudio.com/docs/editor/workspaces)
28-
29-
#### In IntelliJ
30-
[*Learn more*](https://www.jetbrains.com/help/idea/add-items-to-project.html#import-items)
31-
</details>
32-
33-
<details>
34-
<summary>Symlink the the directory into your project directory.</summary>
35-
36-
In these example we'll link the directory into the `myproject` project as `.glua`, but you can use any name you want.
37-
38-
> **Note**
39-
> You should include `.glua` in your project `.gitignore` file. > That way you don't commit the API files to your project > version-control.
40-
41-
#### On Windows
42-
`mklink /d "C:\Program Files (x86)\Steam\steamapps\common\GarrysMod\garrysmod\lua\myproject\.glua" "C:\Users\YOUR_USERNAME\glua-api-snippets"`
43-
44-
#### On Linux
45-
`ln -s ~/glua-api-snippets ~/.steam/steam/SteamApps/common/GarrysMod/garrysmod/lua/myproject/.glua`
46-
47-
#### On macOS
48-
`ln -s ~/glua-api-snippets ~/Library/Application\ Support/Steam/steamapps/common/GarrysMod/garrysmod/lua/myproject/.glua`
49-
50-
5. Restart your editor and enjoy autocompletion:
22+
4. You will now get autocompletion for the Garry's Mod Lua API in your Garry's Mod projects.
5123

5224
<div align="center">
5325

5426
![VSCode showing autocomplete options from the GLua API while typing code with EmmyLua](docs/demo-autocompletion.gif)
5527

5628
</div>
5729

30+
*Alternatively download the latest release and include or symlink it into your workspace. Get the release from [🔗 the releases page](https://github.com/luttje/glua-api-snippets/releases) it's named something like `YYYY-MM-DD_HH-MM-SS.lua.zip` .*
31+
5832
## 📅 **Automatically up-to-date**
5933

6034
Using GitHub Actions, this repository is automatically updated every first day of the month at around 00:00 UTC.
6135

6236
A workflow will automatically scrape the latest Garry's Mod Lua API from [the Garry's Mod Wiki](https://wiki.facepunch.com/gmod/) and package them into [🔗 a release](https://github.com/luttje/glua-api-snippets/releases).
6337

38+
> **Note**
39+
>
40+
> The Lua Language Server addon may not be 100% up-to-date with the definitions in this repository. You can help us out by updating it for everyone. There are instructions on how to do this in [the `CONTRIBUTING.md` file](https://github.com/luttje/glua-api-snippets/blob/main/CONTRIBUTING.md#updating-the-addon-for-lua-language-server).
41+
6442
## 🤖 Advanced Usage
6543

6644
### Running the Scraper Locally

__tests__/api-writer/glua-api-writer.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('GLua API Writer', () => {
3636
expect(api).toEqual(structApiDefinition);
3737
});
3838

39-
// it('should be able to write EmmyLua API files directly from wiki pages', async () => {
39+
// it('should be able to write Annotated API files directly from wiki pages', async () => {
4040
// const baseUrl = 'https://wiki.facepunch.com/gmod/GM:AcceptInput';
4141
// fetchMock.mockResponseOnce(html, { url: baseUrl });
4242

docs/lls-addon-manager-command.jpg

11.3 KB
Loading

docs/lls-addon-manager-gmod.jpg

14.9 KB
Loading

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
{
22
"name": "glua-api-scraper",
3-
"description": "Scrapes the Garry's Mod Wiki in order to build EmmyLua comments that will provide intellisense help.",
3+
"description": "Scrapes the Garry's Mod Wiki in order to build annotations for Lua Language Server to provide intellisense.",
44
"keywords": [
55
"Garry's Mod",
66
"api",
7-
"EmmyLua"
7+
"EmmyLua",
8+
"Lua",
9+
"Language Server"
810
],
911
"homepage": "https://github.com/luttje/glua-api-snippets",
1012
"repository": {

0 commit comments

Comments
 (0)