Skip to content

Commit

Permalink
Merge branch 'master' of github.com:CppCXY/lua-language-server
Browse files Browse the repository at this point in the history
  • Loading branch information
CppCXY committed Jul 1, 2024
2 parents ab2f9a7 + 3886d2e commit e30b59d
Show file tree
Hide file tree
Showing 90 changed files with 6,318 additions and 4,699 deletions.
17 changes: 17 additions & 0 deletions .github/scripts/check-changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

set -e

CHANGELOG_FILE="changelog.md"

git fetch origin $GITHUB_BASE_REF
git fetch

# Check if the changelog file was modified in the PR
if git diff --name-only origin/$GITHUB_BASE_REF..remotes/pull/$GITHUB_SOURCE_REF | grep -q $CHANGELOG_FILE; then
echo "Thank you for updating the changelog!"
exit 0
else
echo "Changelog has not been updated. Please update $CHANGELOG_FILE!"
exit 1
fi
62 changes: 31 additions & 31 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
push:
branches:
- master
- 'v*.*.*'
tags:
- "*"
pull_request:
Expand All @@ -24,8 +25,8 @@ jobs:
matrix:
include:
- { os: ubuntu-22.04, target: linux, platform: linux-x64, container: 'alpine:latest', libc: musl }
- { os: ubuntu-20.04, target: linux, platform: linux-x64, container: 'ubuntu:18.04' }
- { os: ubuntu-20.04, target: linux, platform: linux-arm64, container: 'ubuntu:18.04' }
- { os: ubuntu-20.04, target: linux, platform: linux-x64 }
- { os: ubuntu-20.04, target: linux, platform: linux-arm64 }
- { os: macos-11, target: darwin, platform: darwin-x64 }
- { os: macos-11, target: darwin, platform: darwin-arm64 }
- { os: windows-latest, target: windows, platform: win32-ia32 }
Expand All @@ -34,49 +35,48 @@ jobs:
container:
image: ${{ matrix.container }}
steps:
- name: Prepare container
if: ${{ matrix.target == 'linux' && matrix.libc != 'musl' }}
run: |
apt-get update
apt-get install -y software-properties-common
add-apt-repository -y ppa:ubuntu-toolchain-r/test # For gcc-9 and g++-9
add-apt-repository -y ppa:git-core/ppa # For git>=2.18.
apt-get update
apt-get install -y sudo git gcc-9 g++-9
- name: Install aarch64-linux-gnu
if: ${{ matrix.platform == 'linux-arm64' && matrix.libc != 'musl' }}
run: |
apt-get update
apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Prepare container env
if: ${{ matrix.target == 'linux' && matrix.libc != 'musl' }}
run: |
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 100
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 100
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Prepare container for musl
if: ${{ matrix.target == 'linux' && matrix.libc == 'musl' }}
run: |
apk update
apk add git ninja bash build-base nodejs linux-headers
- uses: actions/checkout@v3
- name: Prepare for Linux
if: ${{ matrix.target == 'linux' && matrix.libc != 'musl' }}
run: |
sudo apt update
sudo apt install ninja-build
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Build for others step-1
if: ${{ matrix.libc != 'musl' }}
uses: actboy168/setup-luamake@master
- name: Build for Windows
if: ${{ matrix.target == 'windows' }}
run: .\make.bat ${{ matrix.platform }}

- name: Build for others step-2
if: ${{ matrix.libc != 'musl' }}
run: luamake -platform ${{ matrix.platform }}
- name: Build for Linux
if: ${{ matrix.target == 'linux' }}
run: |
./make.sh ${{ matrix.platform }}
- name: Build for macOS
if: ${{ matrix.target == 'darwin' }}
run: |
brew install ninja
./make.sh ${{ matrix.platform }}
- name: Build for musl
if: ${{ matrix.target == 'linux' && matrix.libc == 'musl' }}
run: ./make.sh
- name: Build for x64 glibc
if: ${{ matrix.platform == 'linux-x64' && matrix.libc != 'musl' }}
run: |
docker build -t ubuntu-18.04 .
docker run --rm -v $(pwd):$(pwd) -w $(pwd) ubuntu-18.04 bash -c './make.sh'
- name: Setting up workflow variables
id: vars
Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:
echo PKG_PATH="${PKG_STAGING}/${PKG_NAME}" >> $GITHUB_OUTPUT
echo PKG_STAGING=${PKG_STAGING} >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: ${{ steps.vars.outputs.PKG_BASENAME }}
path: |
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: changelog

on:
pull_request:
types: [opened, synchronize]
branches:
- master

jobs:
check-changelog:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up environment
run: |
echo "GITHUB_SOURCE_REF=${{ github.ref_name }}" >> $GITHUB_ENV
echo "GITHUB_BASE_REF=${{ github.base_ref }}" >> $GITHUB_ENV
- name: Check if changelog is updated
run: .github/scripts/check-changelog.sh
22 changes: 17 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,25 @@ jobs:
fail-fast: false
matrix:
include:
- { os: ubuntu-20.04, platform: linux-x64 }
- { os: macos-14, platform: darwin-arm64 }
- { os: windows-latest, platform: win32-x64 }
- { os: ubuntu-20.04, target: linux, platform: linux-x64 }
- { os: macos-14, target: darwin, platform: darwin-arm64 }
- { os: windows-latest, target: windows, platform: win32-x64 }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actboy168/setup-luamake@master
- run: luamake -platform ${{ matrix.platform }}
- name: Build for Windows
if: ${{ matrix.target == 'windows' }}
run: .\make.bat
- name: Build for Linux
if: ${{ matrix.target == 'linux' }}
run: |
sudo apt update
sudo apt install ninja-build
./make.sh
- name: Build for macOS
if: ${{ matrix.target == 'darwin' }}
run: |
brew install ninja
./make.sh
1 change: 1 addition & 0 deletions .luarc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
"diagnostics": {
"disable": [
"close-non-object",
Expand Down
18 changes: 18 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"print",
"stderr",
],
"windows": {
"luaexe": "${workspaceFolder}/bin/lua-language-server.exe"
}
},
{
"name": "🍄attach",
Expand Down Expand Up @@ -48,6 +51,9 @@
"request": "launch",
"stopOnEntry": false,
"luaexe": "${workspaceFolder}/bin/lua-language-server",
"windows": {
"luaexe": "${workspaceFolder}/bin/lua-language-server.exe"
},
"program": "${workspaceRoot}/tools/build-3rd-meta.lua",
"cpath": "${workspaceFolder}/bin/?.dll;${workspaceFolder}/bin/?.so",
"console": "integratedTerminal",
Expand All @@ -67,6 +73,9 @@
"request": "launch",
"stopOnEntry": false,
"luaexe": "${workspaceFolder}/bin/lua-language-server",
"windows": {
"luaexe": "${workspaceFolder}/bin/lua-language-server.exe"
},
"program": "${workspaceRoot}/tools/locale.lua",
"cpath": "${workspaceFolder}/bin/?.dll;${workspaceFolder}/bin/?.so",
"console": "integratedTerminal",
Expand All @@ -86,6 +95,9 @@
"request": "launch",
"stopOnEntry": false,
"luaexe": "${workspaceFolder}/bin/lua-language-server",
"windows": {
"luaexe": "${workspaceFolder}/bin/lua-language-server.exe"
},
"program": "${workspaceRoot}/tools/build-doc.lua",
"cpath": "${workspaceFolder}/bin/?.dll;${workspaceFolder}/bin/?.so",
"console": "integratedTerminal",
Expand All @@ -106,6 +118,9 @@
"stopOnEntry": false,
"program": "${workspaceRoot}/main.lua",
"luaexe": "${workspaceFolder}/bin/lua-language-server",
"windows": {
"luaexe": "${workspaceFolder}/bin/lua-language-server.exe"
},
"cpath": null,
"arg": [
"--check",
Expand All @@ -125,6 +140,9 @@
"stopOnEntry": false,
"program": "${workspaceRoot}/main.lua",
"luaexe": "${workspaceFolder}/bin/lua-language-server",
"windows": {
"luaexe": "${workspaceFolder}/bin/lua-language-server.exe"
},
"cpath": null,
"arg": [
"--doc",
Expand Down
2 changes: 1 addition & 1 deletion 3rd/bee.lua
Submodule bee.lua updated 131 files
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Dockerfile

FROM ubuntu:18.04

# Install necessary packages
RUN apt-get update && \
apt-get install -y software-properties-common && \
add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
add-apt-repository -y ppa:git-core/ppa && \
apt-get install -y git gcc-9 g++-9 wget tar gzip rsync ninja-build

# Use alternative gcc
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 100 && \
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 100
117 changes: 116 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,112 @@
# changelog

## 3.7.5
## Unreleased
<!-- Add all new changes here. They will be moved under a version at release -->
* `NEW` Add postfix snippet for `unpack`
* `FIX` `diagnostics.severity` defaulting to "Warning" when run using `--check` [#2730](https://github.com/LuaLS/lua-language-server/issues/2730)
* `NEW` Add support for lambda style functions, `|paramList| expr` is syntactic sugar for `function(paramList) return expr end`

## 3.9.3
`2024-6-11`
* `FIX` Sometimes providing incorrect autocompletion when chaining calls

## 3.9.2
`2024-6-6`
* `NEW` Reference workspace symbols in comments using `[some text](lua://symbolName)` syntax
* `FIX` Don't do diagnostics when the workspace is not ready
* `FIX` Autocompletion for enum values ​​is not available in some cases

## 3.9.1
`2024-5-14`
* revert extension runtime

## 3.9.0
`2024-5-11`
* `NEW` goto implementation
* `NEW` narrow the function prototype based on the parameter type
```lua
---@overload fun(a: boolean): A
---@overload fun(a: number): B
local function f(...) end

local r1 = f(true) --> r1 is `A`
local r2 = f(10) --> r2 is `B`
```

## 3.8.3
`2024-4-23`
* `FIX` server may crash when the workspace is using a non-English path.

## 3.8.2
`2024-4-23`
* This is a fake version only for the new version of VSCode, with a core of 3.8.0.

## 3.8.1
`2024-4-23`
* This is a fake version only for the old version of VSCode, with a core of `3.7.4`. Starting from the next minor version, the version requirement for VSCode will be raised to prevent users still using the old version of VSCode from updating to the new version and experiencing compatibility issues.

## 3.8.0
`2024-4-22`
* `NEW` supports tuple type (@[lizho])
```lua
---@type [string, number, boolean]
local t

local x = t[1] --> x is `string`
local y = t[2] --> y is `number`
local z = t[3] --> z is `boolean`
```
* `NEW` generic pattern (@[fesily])
```lua
---@generic T
---@param t Cat.`T`
---@return T
local function f(t) end

local t = f('Smile') --> t is `Cat.Smile`
```
* `NEW` alias and enums supports attribute `partial`
```lua
---@alias Animal Cat

---@alias(partial) Animal Dog

---@type Animal
local animal --> animal is `Cat|Dog` here
```

```lua
---@enum(key) ErrorCodes
local codes1 = {
OK = 0,
ERROR = 1,
FATAL = 2,
}

---@enum(key, partial) ErrorCodes
local codes2 = {
WARN = 3,
INFO = 4,
}

---@type ErrorCodes
local code

code = 'ERROR' --> OK
code = 'WARN' --> OK

```
* `NEW` plugin: add `OnTransFormAst` interface (@[fesily])
* `NEW` plugin: add `OnNodeCompileFunctionParam` interface (@[fesily])
* `NEW` plugin: add `ResolveRequire` interface (@[Artem Dzhemesiuk])
* `NEW` plugin: support multi plugins (@[fesily])
+ setting: `Lua.runtime.plugin` can be `string|string[]`
+ setting: `Lua.runtime.pluginArgs` can be `string[]|table<string, string>`
* `NEW` CLI: `--doc` add option `--doc_out_path <PATH>` (@[Andreas Matthias])
* `NEW` CLI: `--doc_update`, update an existing `doc.json` without using `--doc` again (@[Andreas Matthias])
* `NEW` CLI: `--trust_all_plugins`, this is potentially unsafe for normal use and meant for usage in CI environments only (@[Paul Emmerich])
* `CHG` CLI: `--check` will run plugins (@[Daniel Farrell])
* `FIX` diagnostic: `discard-returns` not works in some blocks (@clay-golem)
* `FIX` rename in library files

## 3.7.4
Expand Down Expand Up @@ -1966,3 +2072,12 @@ f( -- view comments of `1` and `2` in completion
`2020-11-9`

* `NEW` implementation, NEW start!

<!-- contributors -->
[lizho]: (https://github.com/lizho)
[fesily]: (https://github.com/fesily)
[Andreas Matthias]: (https://github.com/AndreasMatthias)
[Daniel Farrell]: (https://github.com/danpf)
[Paul Emmerich]: (https://github.com/emmericp)
[Artem Dzhemesiuk]: (https://github.com/zziger)
[clay-golem]: (https://github.com/clay-golem)
Loading

0 comments on commit e30b59d

Please sign in to comment.