diff options
112 files changed, 2969 insertions, 1389 deletions
diff --git a/.editorconfig b/.editorconfig index 48df1807..e432c7eb 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,90 +1,128 @@ + # see https://github.com/CppCXY/EmmyLuaCodeStyle [*.lua] -# [basic code reformat option] +# [basic] + # optional space/tab indent_style = space # if indent_style is space, this is valid indent_size = 4 # if indent_style is tab, this is valid tab_width = 4 -# only support number -continuation_indent_size = 4 -# if true, continuation_indent_size for local or assign statement is invalid -# however, if the expression list has cross row expression, it will not be aligned to the first expression -local_assign_continuation_align_to_first_expression = false -# function call expression's args will align to first arg -# however, if the args has cross row arg, it will not be aligned to the first arg -align_call_args = false -# if true, format like this "print( "123", 456 )" -keep_one_space_between_call_args_and_parentheses = false -# if true, all function define params will align to first param -align_function_define_params = true -# if true, format like this "local t = { 1, 2, 3 }" -keep_one_space_between_table_and_bracket = true -# if indent_style is tab, this option is invalid -align_table_field_to_first_field = false -# if true, ormat like this "local t <const> = 1" -keep_one_space_between_namedef_and_attribute = false -# continous line distance -max_continuous_line_distance = 1 -# if true, iff any one of the consecutive rows meets the condition of aligning to the equal sign, -# the consecutive rows will be aligned to the equal sign -weak_alignment_rule = true -# see document for detail -continuous_assign_statement_align_to_equal_sign = true -# see document for detail -continuous_assign_table_field_align_to_equal_sign = true -# if true, the label loses its current indentation -label_no_indent = false -# if true, there will be no indentation in the do statement -do_statement_no_indent = false -# if true, the conditional expression of the if statement will not be a continuation line indent -if_condition_no_continuation_indent = false - - -# optional crlf/lf -end_of_line = auto -detect_end_of_line = true - -# [line layout] -# The following configuration supports three expressions -# minLine:${n} -# keepLine -# KeepLine:${n} - -keep_line_after_if_statement = minLine:0 -keep_line_after_do_statement = minLine:0 -keep_line_after_while_statement = minLine:0 -keep_line_after_repeat_statement = minLine:0 -keep_line_after_for_statement = minLine:0 -keep_line_after_local_or_assign_statement = keepLine -keep_line_after_function_define_statement = keepLine:1 - -# [diagnostic] -# the following is code diagnostic options -enable_check_codestyle = true -# this mean utf8 length +# none/single/double +quote_style = none + +continuation_indent = 4 + +# this mean utf8 length , if this is 'unset' then the line width is no longer checked +# this option decides when to chopdown the code max_line_length = 120 -# this will check text end with new line(format always end with new line) + +# optional crlf/lf/cr/auto, if it is 'auto', in windows it is crlf other platforms are lf +# in neovim the value 'auto' is not a valid option, please use 'unset' +end_of_line = auto + +#optional keep/never/always/smart +trailing_table_separator = keep + +# keep/remove/remove_table_only/remove_string_only +call_arg_parentheses = keep + +detect_end_of_line = false + +# this will check text end with new line insert_final_newline = true -# [name style check] -enable_name_style_check = true -# the following is name style check rule -# base option off/camel_case/snake_case/upper_snake_case/pascal_case/same(filename/first_param/'<const string>', snake_case/pascal_case/camel_case) -# all option can use '|' represent or -# for example: -# snake_case | upper_snake_case -# same(first_param, snake_case) -# same('m') -local_name_define_style = camel_case|upper_snake_case -function_param_name_style = camel_case -function_name_define_style = camel_case -local_function_name_define_style = camel_case -table_field_name_define_style = camel_case|pascal_case -global_variable_name_define_style = camel_case|upper_snake_case -module_name_define_style = camel_case -require_module_name_style = camel_case -class_name_define_style = camel_case -table_append_expression_no_space = true -if_condition_align_with_each_other = true +# [space] +space_around_table_field_list = true + +space_before_attribute = true + +space_before_function_open_parenthesis = false + +space_before_function_call_open_parenthesis = false + +space_before_closure_open_parenthesis = true + +space_before_function_call_single_arg = true + +space_before_open_square_bracket = false + +space_inside_function_call_parentheses = false + +space_inside_function_param_list_parentheses = false + +space_inside_square_brackets = false + +# like t[#t+1] = 1 +space_around_table_append_operator = true + +ignore_spaces_inside_function_call = false + +space_before_inline_comment = 1 + +# [operator space] +space_around_math_operator = true + +space_after_comma = true + +space_after_comma_in_for_statement = true + +space_around_concat_operator = true + +# [align] + +align_call_args = false + +align_function_params = true + +align_continuous_assign_statement = true + +align_continuous_rect_table_field = true + +align_if_branch = true + +align_array_table = true + +# [indent] + +never_indent_before_if_condition = false + +never_indent_comment_on_if_branch = false + +# [line space] + +# The following configuration supports four expressions +# keep +# fixed(n) +# min(n) +# max(n) +# for eg. min(2) + +line_space_after_if_statement = keep + +line_space_after_do_statement = keep + +line_space_after_while_statement = keep + +line_space_after_repeat_statement = keep + +line_space_after_for_statement = keep + +line_space_after_local_or_assign_statement = keep + +line_space_after_function_statement = fixed(2) + +line_space_after_expression_statement = keep + +line_space_after_comment = keep + +# [line break] +break_all_list_when_line_exceed = false + +auto_collapse_lines = false + +# [preference] +ignore_space_after_colon = true + +remove_call_expression_list_finish_comma = false diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 0bb446b1..07e67264 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1 @@ -custom: ["https://paypal.me/sumneko", "https://github.com/sumneko/lua-language-server/issues/484"] +custom: ["https://paypal.me/sumneko", "https://github.com/LuaLS/lua-language-server/issues/484"] diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index 0451389e..9652d3cf 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -88,7 +88,7 @@ body: label: Log File description: > Please provide your log file. Refer to the wiki to find your log file: - https://github.com/sumneko/lua-language-server/wiki/FAQ#where-can-i-find-the-log-file + https://github.com/LuaLS/lua-language-server/wiki/FAQ#where-can-i-find-the-log-file - type: markdown attributes: value: | diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6f2ca446..835f6b72 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,5 +1,8 @@ name: build +permissions: + contents: write + on: push: branches: @@ -20,19 +23,37 @@ jobs: fail-fast: false matrix: include: - - { os: ubuntu-20.04, target: linux, platform: linux-x64 } - - { os: ubuntu-20.04, target: linux, platform: linux-arm64 } + - { 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: macos-11, target: darwin, platform: darwin-x64 } - { os: macos-11, target: darwin, platform: darwin-arm64 } - { os: windows-latest, target: windows, platform: win32-ia32 } - { os: windows-latest, target: windows, platform: win32-x64 } runs-on: ${{ matrix.os }} + container: + image: ${{ matrix.container }} steps: + - name: Prepare container + if: ${{ matrix.target == 'linux' }} + 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' }} run: | - sudo apt-get update - sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu + apt-get update + apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu + + - name: Prepare container + if: ${{ matrix.target == 'linux' }} + 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 - uses: actions/checkout@v3 with: @@ -118,7 +139,7 @@ jobs: PKG_SUBMOD_NAME="${{ env.PROJECT }}-${{ steps.vars.outputs.PKG_VERSION }}-submodules.zip" PKG_SUBMOD_PATH="${STAGING}/$PKG_SUBMOD_NAME" - zip -r $PKG_SUBMOD_PATH ./ -x "*.git*" -x "*.vscode*" -x "build*" -x "${{ env.BIN_DIR }}*" -x "${STAGING}*" + zip -r $PKG_SUBMOD_PATH ./ -x "*.git*" -x "*.vscode*" -x "build*" -x "${{ env.BIN_DIR }}*" -x "${STAGING}*" -x "3rd/json.lua*" -x "log*" -x "ci_staging*" echo PKG_SUBMOD_PATH=${PKG_SUBMOD_PATH} >> $GITHUB_OUTPUT diff --git a/.gitmodules b/.gitmodules index 1dfe374c..ef4d5f5e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,3 +16,6 @@ [submodule "3rd/EmmyLuaCodeStyle"] path = 3rd/EmmyLuaCodeStyle url = https://github.com/CppCXY/EmmyLuaCodeStyle +[submodule "3rd/json.lua"] + path = 3rd/json.lua + url = https://github.com/actboy168/json.lua diff --git a/3rd/EmmyLuaCodeStyle b/3rd/EmmyLuaCodeStyle -Subproject 9ffcbcb75b2345922f1e2e2f6c31fba4ff2b195 +Subproject fab3d066e14cea1bf1ebe7927d1ceba098e78d1 diff --git a/3rd/bee.lua b/3rd/bee.lua -Subproject 4da6416cdf03efef1f6943f0094a634c458e1a8 +Subproject 9a11b7c74d5d5c377b0af0ab54313573dce1aca diff --git a/3rd/json.lua b/3rd/json.lua new file mode 160000 +Subproject be1d71ff7afe84942eb3f33b76c8bf75306c463 diff --git a/3rd/love-api b/3rd/love-api -Subproject 17bcdfc7beda6848a94aa42d6914d5c393b1752 +Subproject 495ecc72d994f5d52fc21592dda9d16f4fd75ba diff --git a/3rd/lovr-api b/3rd/lovr-api -Subproject d3645abccbd6e9b5fd8cb3d4f7adedb4e932c3e +Subproject f08de6bc658f385dfa1b6d1fcba52da5f88b785 diff --git a/3rd/lpeglabel b/3rd/lpeglabel -Subproject f3745e27864607f47811ca6edc6eabd69978600 +Subproject e25eb35666201b10dc2778d6147ea36a9f6e033 diff --git a/3rd/luamake b/3rd/luamake -Subproject d5e957c49c6fe55cb1fc7cb25f2a069d06c74ff +Subproject 915baa5a3141e3f45708b59a7bbc76d7a701d7f @@ -1,10 +1,9 @@ # lua-language-server -![build](https://github.com/sumneko/lua-language-server/workflows/build/badge.svg) +[![build](https://github.com/LuaLS/lua-language-server/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/LuaLS/lua-language-server/actions/workflows/build.yml) [![version](https://vsmarketplacebadges.dev/version-short/sumneko.lua.svg)](https://marketplace.visualstudio.com/items?itemName=sumneko.lua) ![installs](https://vsmarketplacebadges.dev/installs-short/sumneko.lua.svg) ![downloads](https://vsmarketplacebadges.dev/downloads-short/sumneko.lua.svg) -[![Average time to resolve an issue](https://isitmaintained.com/badge/resolution/sumneko/lua-language-server.svg)](https://github.com/sumneko/lua-language-server/issues "Average time to resolve an issue") ***Lua development just got a whole lot better*** 🧠 @@ -13,59 +12,60 @@ The Lua language server provides various language features for Lua to make devel ## Features -- 📄 Over 20 supported [annotations](https://github.com/sumneko/lua-language-server/wiki/Annotations) for documenting your code +- 📄 Over 20 supported [annotations](https://github.com/LuaLS/lua-language-server/wiki/Annotations) for documenting your code - ↪ Go to definition -- 🦺 Dynamic [type checking](https://github.com/sumneko/lua-language-server/wiki/Type-Checking) +- 🦺 Dynamic [type checking](https://github.com/LuaLS/lua-language-server/wiki/Type-Checking) - 🔍 Find references -- ⚠️ [Diagnostics/Warnings](https://github.com/sumneko/lua-language-server/wiki/Diagnostics) -- 🕵️ [Syntax checking](https://github.com/sumneko/lua-language-server/wiki/Syntax-Errors) +- ⚠️ [Diagnostics/Warnings](https://github.com/LuaLS/lua-language-server/wiki/Diagnostics) +- 🕵️ [Syntax checking](https://github.com/LuaLS/lua-language-server/wiki/Syntax-Errors) - 📝 Element renaming - 🗨️ Hover to view details on variables, functions, and more - 🖊️ Autocompletion -- 📚 Support for [libraries](https://github.com/sumneko/lua-language-server/wiki/Libraries) -- 💅 [Code formatting](https://github.com/sumneko/lua-language-server/wiki/Formatter) -- 💬 [Spell checking](https://github.com/sumneko/lua-language-server/wiki/Formatter) -- 🛠️ Custom [plugins](https://github.com/sumneko/lua-language-server/wiki/Plugins) +- 📚 Support for [libraries](https://github.com/LuaLS/lua-language-server/wiki/Libraries) +- 💅 [Code formatting](https://github.com/LuaLS/lua-language-server/wiki/Formatter) +- 💬 [Spell checking](https://github.com/LuaLS/lua-language-server/wiki/Formatter) +- 🛠️ Custom [plugins](https://github.com/LuaLS/lua-language-server/wiki/Plugins) +- 📖 [Documentation Generation](https://github.com/LuaLS/lua-language-server/wiki/Export-Documentation) ## Install The language server can easily be installed for use in VS Code, but it can also be used by other clients using the command line. ### Visual Studio Code -[![Install in VS Code](https://img.shields.io/badge/Install%20For-VS%20Code-blue?style=for-the-badge&logo=visualstudiocode "Install in VS Code")](https://marketplace.visualstudio.com/items?itemName=sumneko.lua) +[![Install in VS Code](https://img.shields.io/badge/VS%20Code-Install-blue?style=for-the-badge&logo=visualstudiocode "Install in VS Code")](https://marketplace.visualstudio.com/items?itemName=sumneko.lua) The language server and Visual Studio Code client can be installed from [the VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=sumneko.lua). -![](https://github.com/sumneko/vscode-lua/raw/master/images//Install%20In%20VSCode.gif) +![](https://github.com/LuaLS/vscode-lua/raw/master/images//Install%20In%20VSCode.gif) ### Command Line -[![Install for command line](https://img.shields.io/badge/Install%20For-Command%20Line-blue?style=for-the-badge&logo=windowsterminal "Install for command line")](https://github.com/sumneko/lua-language-server/wiki/Getting-Started#command-line) +[![Install for command line](https://img.shields.io/badge/Command%20Line-Install-blue?style=for-the-badge&logo=windowsterminal "Install for command line")](https://github.com/LuaLS/lua-language-server/wiki/Getting-Started#command-line) -Check the [wiki for a guide](https://github.com/sumneko/lua-language-server/wiki/Getting-Started#command-line) to install the language server for use on the command line. This allows the language server to be used for NeoVim and other clients that follow the language server protocol. +Check the [wiki for a guide](https://github.com/LuaLS/lua-language-server/wiki/Getting-Started#command-line) to install the language server for use on the command line. This allows the language server to be used with NeoVim and [other clients](https://microsoft.github.io/language-server-protocol/implementors/tools/) that follow the [language server protocol](https://microsoft.github.io/language-server-protocol/overviews/lsp/overview/). ## Supported Lua Versions -| Version | Supported | +| Version | Supported | | :-----: | :------------: | -| Lua 5.1 | ![][checkmark] | -| Lua 5.2 | ![][checkmark] | -| Lua 5.3 | ![][checkmark] | -| Lua 5.4 | ![][checkmark] | -| LuaJIT | ![][checkmark] | +| Lua 5.1 | ![✅][checkmark] | +| Lua 5.2 | ![✅][checkmark] | +| Lua 5.3 | ![✅][checkmark] | +| Lua 5.4 | ![✅][checkmark] | +| LuaJIT | ![✅][checkmark] | ## Links -- [Changelog](https://github.com/sumneko/lua-language-server/blob/master/changelog.md) -- [Wiki](https://github.com/sumneko/lua-language-server/wiki) -- [FAQ](https://github.com/sumneko/lua-language-server/wiki/FAQ) +- [Changelog](https://github.com/LuaLS/lua-language-server/blob/master/changelog.md) +- [Wiki](https://github.com/LuaLS/lua-language-server/wiki) +- [FAQ](https://github.com/LuaLS/lua-language-server/wiki/FAQ) - [Report an issue][issues] - [Suggest a feature][issues] -- [Discuss](https://github.com/sumneko/lua-language-server/discussions) +- [Discuss](https://github.com/LuaLS/lua-language-server/discussions) > If you find any mistakes, please [report it][issues] or open a [pull request][pulls] if you have a fix of your own ❤️ > > 如果你发现了任何错误,请[告诉我][issues]或使用[Pull Requests][pulls]来直接修复。❤️ -[issues]: https://github.com/sumneko/lua-language-server/issues -[pulls]: https://github.com/sumneko/lua-language-server/pulls +[issues]: https://github.com/LuaLS/lua-language-server/issues +[pulls]: https://github.com/LuaLS/lua-language-server/pulls ## Available Languages @@ -75,26 +75,25 @@ Check the [wiki for a guide](https://github.com/sumneko/lua-language-server/wiki - `pt-br` 🇧🇷 -> ℹ Note: All translations are provided and collaborated on by the community. If you find an inappropriate or harmful translation, [please report it immediately](https://github.com/sumneko/lua-language-server/issues). +> **Note** +> All translations are provided and collaborated on by the community. If you find an inappropriate or harmful translation, [please report it immediately](https://github.com/LuaLS/lua-language-server/issues). -Are you able to [provide a translation](https://github.com/sumneko/lua-language-server/wiki/Translations)? It would be greatly appreciated! +Are you able to [provide a translation](https://github.com/LuaLS/lua-language-server/wiki/Translations)? It would be greatly appreciated! -Thank you to [all contributors of translations](https://github.com/sumneko/lua-language-server/commits/master/locale)! - -[en-US]: https://github.com/sumneko/lua-language-server/tree/master/locale/en-us +Thank you to [all contributors of translations](https://github.com/LuaLS/lua-language-server/commits/master/locale)! ## Configuration -Configuration of the server can be done in a number of ways, which are explained more in-depth in the [wiki](https://github.com/sumneko/lua-language-server/wiki/Configuration-File). +Configuration of the server can be done in a number of ways, which are explained more in-depth in the [wiki](https://github.com/LuaLS/lua-language-server/wiki/Configuration-File). ### Visual Studio Code You can use the [settings editor](https://code.visualstudio.com/docs/getstarted/settings#_settings-editor) or edit the [raw JSON file](https://code.visualstudio.com/docs/getstarted/settings#_settingsjson). ### Other -See the [configuration file wiki page](https://github.com/sumneko/lua-language-server/wiki/Configuration-File). +See the [configuration file wiki page](https://github.com/LuaLS/lua-language-server/wiki/Configuration-File). ## Privacy -This language server has **opt-in** telemetry that collects usage data and sends it to the development team to help improve the extension. Read our [privacy policy](https://github.com/sumneko/lua-language-server/wiki/Home#privacy) to learn more. +The language server had **opt-in** telemetry that collected usage data and sent it to the development team to help improve the extension. Read our [privacy policy](https://github.com/LuaLS/lua-language-server/wiki/Home#privacy) to learn more. Telemetry was removed in `v3.6.5` and is no longer part of the language server. ## Contributors @@ -106,13 +105,13 @@ Software that the language server (or the development of it) uses: * [bee.lua](https://github.com/actboy168/bee.lua) * [luamake](https://github.com/actboy168/luamake) * [LPegLabel](https://github.com/sqmedeiros/lpeglabel) -* [LuaParser](https://github.com/sumneko/LuaParser) +* [LuaParser](https://github.com/LuaLS/LuaParser) * [ScreenToGif](https://github.com/NickeManarin/ScreenToGif) * [vscode-languageclient](https://github.com/microsoft/vscode-languageserver-node) * [lua.tmbundle](https://github.com/textmate/lua.tmbundle) * [EmmyLua](https://emmylua.github.io) -* [lua-glob](https://github.com/sumneko/lua-glob) -* [utility](https://github.com/sumneko/utility) +* [lua-glob](https://github.com/LuaLS/lua-glob) +* [utility](https://github.com/LuaLS/utility) * [vscode-lua-doc](https://github.com/actboy168/vscode-lua-doc) * [json.lua](https://github.com/actboy168/json.lua) * [EmmyLuaCodeStyle](https://github.com/CppCXY/EmmyLuaCodeStyle) diff --git a/changelog.md b/changelog.md index c539f45b..8b1537c8 100644 --- a/changelog.md +++ b/changelog.md @@ -1,9 +1,112 @@ # changelog +## 3.6.18 +* `FIX` [#1943] +* `FIX` [#1996] + +[#1943]: https://github.com/LuaLS/lua-language-server/issues/1943 +[#1996]: https://github.com/LuaLS/lua-language-server/issues/1996 + +## 3.6.17 +`2023-3-9` +* `CHG` export documents: export global variables +* `FIX` [#1715] +* `FIX` [#1753] +* `FIX` [#1914] +* `FIX` [#1922] +* `FIX` [#1924] +* `FIX` [#1928] +* `FIX` [#1945] +* `FIX` [#1955] +* `FIX` [#1978] + +[#1715]: https://github.com/LuaLS/lua-language-server/issues/1715 +[#1753]: https://github.com/LuaLS/lua-language-server/issues/1753 +[#1914]: https://github.com/LuaLS/lua-language-server/issues/1914 +[#1922]: https://github.com/LuaLS/lua-language-server/issues/1922 +[#1924]: https://github.com/LuaLS/lua-language-server/issues/1924 +[#1928]: https://github.com/LuaLS/lua-language-server/issues/1928 +[#1945]: https://github.com/LuaLS/lua-language-server/issues/1945 +[#1955]: https://github.com/LuaLS/lua-language-server/issues/1955 +[#1978]: https://github.com/LuaLS/lua-language-server/issues/1978 + +## 3.6.13 +`2023-3-2` +* `FIX` setting: `Lua.addonManager.enable` should be `true` by default +* `FIX` failed to publish to Windows + +## 3.6.12 +`2023-3-2` +* `NEW` [Addon Manager](https://github.com/LuaLS/lua-language-server/discussions/1607), try it with command `lua.addon_manager.open`. Thanks to [carsakiller](https://github.com/carsakiller)! + +## 3.6.11 +`2023-2-13` +* `CHG` completion: don't show loading process +* `FIX` [#1886] +* `FIX` [#1887] +* `FIX` [#1889] +* `FIX` [#1895] +* `FIX` [#1902] + +[#1886]: https://github.com/LuaLS/lua-language-server/issues/1886 +[#1887]: https://github.com/LuaLS/lua-language-server/issues/1887 +[#1889]: https://github.com/LuaLS/lua-language-server/issues/1889 +[#1895]: https://github.com/LuaLS/lua-language-server/issues/1895 +[#1902]: https://github.com/LuaLS/lua-language-server/issues/1902 + +## 3.6.10 +`2023-2-7` +* `FIX` [#1869] +* `FIX` [#1872] + +[#1869]: https://github.com/LuaLS/lua-language-server/issues/1869 +[#1872]: https://github.com/LuaLS/lua-language-server/issues/1872 + +## 3.6.9 +`2023-2-2` +* `FIX` [#1864] +* `FIX` [#1868] +* `FIX` [#1869] +* `FIX` [#1871] + +[#1864]: https://github.com/LuaLS/lua-language-server/issues/1864 +[#1868]: https://github.com/LuaLS/lua-language-server/issues/1868 +[#1869]: https://github.com/LuaLS/lua-language-server/issues/1869 +[#1871]: https://github.com/LuaLS/lua-language-server/issues/1871 + +## 3.6.8 +`2023-1-31` +* `NEW` command `lua.exportDocument` . VSCode will display this command in the right-click menu +* `CHG` setting `Lua.workspace.supportScheme` has been removed. All schemes are supported if the language id is `lua` +* `FIX` [#1831] +* `FIX` [#1838] +* `FIX` [#1841] +* `FIX` [#1851] +* `FIX` [#1855] +* `FIX` [#1857] + +[#1831]: https://github.com/LuaLS/lua-language-server/issues/1831 +[#1838]: https://github.com/LuaLS/lua-language-server/issues/1838 +[#1841]: https://github.com/LuaLS/lua-language-server/issues/1841 +[#1851]: https://github.com/LuaLS/lua-language-server/issues/1851 +[#1855]: https://github.com/LuaLS/lua-language-server/issues/1855 +[#1857]: https://github.com/LuaLS/lua-language-server/issues/1857 + +## 3.6.7 +`2023-1-20` +* `FIX` [#1810] +* `FIX` [#1829] + +[#1810]: https://github.com/LuaLS/lua-language-server/issues/1810 +[#1829]: https://github.com/LuaLS/lua-language-server/issues/1829 + ## 3.6.6 -* `NEW` VSCode: add addon manager, you can install, enable, disable, and uninstall addons from the [LLS-Addons repo](https://github.com/carsakiller/LLS-Addons) by command `lua.addon_manager.open`. - this feature is contributed by [carsakiller](https://github.com/carsakiller), thank you! - ![](https://user-images.githubusercontent.com/61925890/211632470-6cdbacdf-b5f7-4797-9998-ca6577d3947f.gif) +`2023-1-17` +* `FIX` [#1825] +* `FIX` [#1826] + +[#1825]: https://github.com/LuaLS/lua-language-server/issues/1825 +[#1826]: https://github.com/LuaLS/lua-language-server/issues/1826 ## 3.6.5 `2023-1-16` @@ -28,16 +131,16 @@ * `FIX` [#1811] * `FIX` [#1824] -[#831]: https://github.com/sumneko/lua-language-server/issues/831 -[#1729]: https://github.com/sumneko/lua-language-server/issues/1729 -[#1737]: https://github.com/sumneko/lua-language-server/issues/1737 -[#1751]: https://github.com/sumneko/lua-language-server/issues/1751 -[#1767]: https://github.com/sumneko/lua-language-server/issues/1767 -[#1796]: https://github.com/sumneko/lua-language-server/issues/1796 -[#1805]: https://github.com/sumneko/lua-language-server/issues/1805 -[#1808]: https://github.com/sumneko/lua-language-server/issues/1808 -[#1811]: https://github.com/sumneko/lua-language-server/issues/1811 -[#1824]: https://github.com/sumneko/lua-language-server/issues/1824 +[#831]: https://github.com/LuaLS/lua-language-server/issues/831 +[#1729]: https://github.com/LuaLS/lua-language-server/issues/1729 +[#1737]: https://github.com/LuaLS/lua-language-server/issues/1737 +[#1751]: https://github.com/LuaLS/lua-language-server/issues/1751 +[#1767]: https://github.com/LuaLS/lua-language-server/issues/1767 +[#1796]: https://github.com/LuaLS/lua-language-server/issues/1796 +[#1805]: https://github.com/LuaLS/lua-language-server/issues/1805 +[#1808]: https://github.com/LuaLS/lua-language-server/issues/1808 +[#1811]: https://github.com/LuaLS/lua-language-server/issues/1811 +[#1824]: https://github.com/LuaLS/lua-language-server/issues/1824 ## 3.6.4 `2022-11-29` @@ -58,17 +161,17 @@ * `FIX` [#1704] * `FIX` [#1717] -[#1698]: https://github.com/sumneko/lua-language-server/issues/1698 -[#1704]: https://github.com/sumneko/lua-language-server/issues/1704 -[#1717]: https://github.com/sumneko/lua-language-server/issues/1717 +[#1698]: https://github.com/LuaLS/lua-language-server/issues/1698 +[#1704]: https://github.com/LuaLS/lua-language-server/issues/1704 +[#1717]: https://github.com/LuaLS/lua-language-server/issues/1717 ## 3.6.3 `2022-11-14` * `FIX` [#1684] * `FIX` [#1692] -[#1684]: https://github.com/sumneko/lua-language-server/issues/1684 -[#1692]: https://github.com/sumneko/lua-language-server/issues/1692 +[#1684]: https://github.com/LuaLS/lua-language-server/issues/1684 +[#1692]: https://github.com/LuaLS/lua-language-server/issues/1692 ## 3.6.2 `2022-11-10` @@ -78,10 +181,10 @@ * `FIX` [#1679] * `FIX` [#1680] -[#1676]: https://github.com/sumneko/lua-language-server/issues/1676 -[#1677]: https://github.com/sumneko/lua-language-server/issues/1677 -[#1679]: https://github.com/sumneko/lua-language-server/issues/1679 -[#1680]: https://github.com/sumneko/lua-language-server/issues/1680 +[#1676]: https://github.com/LuaLS/lua-language-server/issues/1676 +[#1677]: https://github.com/LuaLS/lua-language-server/issues/1677 +[#1679]: https://github.com/LuaLS/lua-language-server/issues/1679 +[#1680]: https://github.com/LuaLS/lua-language-server/issues/1680 ## 3.6.1 `2022-11-8` @@ -90,7 +193,7 @@ * `FIX` description disapeared for overloaded function * `FIX` [#1675] -[#1675]: https://github.com/sumneko/lua-language-server/issues/1675 +[#1675]: https://github.com/LuaLS/lua-language-server/issues/1675 ## 3.6.0 `2022-11-8` @@ -124,8 +227,8 @@ * `Lua.doc.privateName`: treat matched fields as private * `Lua.doc.protectedName`: treat matched fields as protected * `Lua.doc.packageName`: treat matched fields as package -* `NEW` CLI `--doc [path]` to make docs. -server will generate `doc.json` and `doc.md` in `LOGPATH`. +* `NEW` CLI `--doc [path]` to make docs. +server will generate `doc.json` and `doc.md` in `LOGPATH`. `doc.md` is generated by `doc.json` by example code `script/cli/doc2md.lua`. * `CHG` [#1558] detect multi libraries * `CHG` [#1458] `semantic-tokens`: global variable is setted to `variable.global` @@ -254,100 +357,100 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. * `FIX` [#1662] * `FIX` [#1672] -[#1153]: https://github.com/sumneko/lua-language-server/issues/1153 -[#1177]: https://github.com/sumneko/lua-language-server/issues/1177 -[#1201]: https://github.com/sumneko/lua-language-server/issues/1201 -[#1202]: https://github.com/sumneko/lua-language-server/issues/1202 -[#1332]: https://github.com/sumneko/lua-language-server/issues/1332 -[#1344]: https://github.com/sumneko/lua-language-server/issues/1344 -[#1374]: https://github.com/sumneko/lua-language-server/issues/1374 -[#1434]: https://github.com/sumneko/lua-language-server/issues/1434 -[#1457]: https://github.com/sumneko/lua-language-server/issues/1457 -[#1458]: https://github.com/sumneko/lua-language-server/issues/1458 -[#1479]: https://github.com/sumneko/lua-language-server/issues/1479 -[#1480]: https://github.com/sumneko/lua-language-server/issues/1480 -[#1484]: https://github.com/sumneko/lua-language-server/issues/1484 -[#1533]: https://github.com/sumneko/lua-language-server/issues/1533 -[#1557]: https://github.com/sumneko/lua-language-server/issues/1557 -[#1558]: https://github.com/sumneko/lua-language-server/issues/1558 -[#1561]: https://github.com/sumneko/lua-language-server/issues/1561 -[#1567]: https://github.com/sumneko/lua-language-server/issues/1567 -[#1575]: https://github.com/sumneko/lua-language-server/issues/1575 -[#1582]: https://github.com/sumneko/lua-language-server/issues/1582 -[#1593]: https://github.com/sumneko/lua-language-server/issues/1593 -[#1595]: https://github.com/sumneko/lua-language-server/issues/1595 -[#1599]: https://github.com/sumneko/lua-language-server/issues/1599 -[#1606]: https://github.com/sumneko/lua-language-server/issues/1606 -[#1608]: https://github.com/sumneko/lua-language-server/issues/1608 -[#1626]: https://github.com/sumneko/lua-language-server/issues/1626 -[#1637]: https://github.com/sumneko/lua-language-server/issues/1637 -[#1640]: https://github.com/sumneko/lua-language-server/issues/1640 -[#1641]: https://github.com/sumneko/lua-language-server/issues/1641 -[#1642]: https://github.com/sumneko/lua-language-server/issues/1642 -[#1662]: https://github.com/sumneko/lua-language-server/issues/1662 -[#1663]: https://github.com/sumneko/lua-language-server/issues/1663 -[#1670]: https://github.com/sumneko/lua-language-server/issues/1670 -[#1672]: https://github.com/sumneko/lua-language-server/issues/1672 +[#1153]: https://github.com/LuaLS/lua-language-server/issues/1153 +[#1177]: https://github.com/LuaLS/lua-language-server/issues/1177 +[#1201]: https://github.com/LuaLS/lua-language-server/issues/1201 +[#1202]: https://github.com/LuaLS/lua-language-server/issues/1202 +[#1332]: https://github.com/LuaLS/lua-language-server/issues/1332 +[#1344]: https://github.com/LuaLS/lua-language-server/issues/1344 +[#1374]: https://github.com/LuaLS/lua-language-server/issues/1374 +[#1434]: https://github.com/LuaLS/lua-language-server/issues/1434 +[#1457]: https://github.com/LuaLS/lua-language-server/issues/1457 +[#1458]: https://github.com/LuaLS/lua-language-server/issues/1458 +[#1479]: https://github.com/LuaLS/lua-language-server/issues/1479 +[#1480]: https://github.com/LuaLS/lua-language-server/issues/1480 +[#1484]: https://github.com/LuaLS/lua-language-server/issues/1484 +[#1533]: https://github.com/LuaLS/lua-language-server/issues/1533 +[#1557]: https://github.com/LuaLS/lua-language-server/issues/1557 +[#1558]: https://github.com/LuaLS/lua-language-server/issues/1558 +[#1561]: https://github.com/LuaLS/lua-language-server/issues/1561 +[#1567]: https://github.com/LuaLS/lua-language-server/issues/1567 +[#1575]: https://github.com/LuaLS/lua-language-server/issues/1575 +[#1582]: https://github.com/LuaLS/lua-language-server/issues/1582 +[#1593]: https://github.com/LuaLS/lua-language-server/issues/1593 +[#1595]: https://github.com/LuaLS/lua-language-server/issues/1595 +[#1599]: https://github.com/LuaLS/lua-language-server/issues/1599 +[#1606]: https://github.com/LuaLS/lua-language-server/issues/1606 +[#1608]: https://github.com/LuaLS/lua-language-server/issues/1608 +[#1626]: https://github.com/LuaLS/lua-language-server/issues/1626 +[#1637]: https://github.com/LuaLS/lua-language-server/issues/1637 +[#1640]: https://github.com/LuaLS/lua-language-server/issues/1640 +[#1641]: https://github.com/LuaLS/lua-language-server/issues/1641 +[#1642]: https://github.com/LuaLS/lua-language-server/issues/1642 +[#1662]: https://github.com/LuaLS/lua-language-server/issues/1662 +[#1663]: https://github.com/LuaLS/lua-language-server/issues/1663 +[#1670]: https://github.com/LuaLS/lua-language-server/issues/1670 +[#1672]: https://github.com/LuaLS/lua-language-server/issues/1672 ## 3.5.6 `2022-9-16` -* `FIX` [#1439](https://github.com/sumneko/lua-language-server/issues/1439) -* `FIX` [#1467](https://github.com/sumneko/lua-language-server/issues/1467) -* `FIX` [#1506](https://github.com/sumneko/lua-language-server/issues/1506) -* `FIX` [#1537](https://github.com/sumneko/lua-language-server/issues/1537) +* `FIX` [#1439](https://github.com/LuaLS/lua-language-server/issues/1439) +* `FIX` [#1467](https://github.com/LuaLS/lua-language-server/issues/1467) +* `FIX` [#1506](https://github.com/LuaLS/lua-language-server/issues/1506) +* `FIX` [#1537](https://github.com/LuaLS/lua-language-server/issues/1537) ## 3.5.5 `2022-9-7` -* `FIX` [#1529](https://github.com/sumneko/lua-language-server/issues/1529) -* `FIX` [#1530](https://github.com/sumneko/lua-language-server/issues/1530) +* `FIX` [#1529](https://github.com/LuaLS/lua-language-server/issues/1529) +* `FIX` [#1530](https://github.com/LuaLS/lua-language-server/issues/1530) ## 3.5.4 `2022-9-6` * `NEW` `type-formatting`: fix wrong indentation of VSCode * `CHG` `document-symbol`: redesigned to better support for `Sticky Scroll` feature of VSCode * `FIX` `diagnostics.workspaceDelay` can not prevent first workspace diagnostic -* `FIX` [#1476](https://github.com/sumneko/lua-language-server/issues/1476) -* `FIX` [#1490](https://github.com/sumneko/lua-language-server/issues/1490) -* `FIX` [#1493](https://github.com/sumneko/lua-language-server/issues/1493) -* `FIX` [#1499](https://github.com/sumneko/lua-language-server/issues/1499) -* `FIX` [#1526](https://github.com/sumneko/lua-language-server/issues/1526) +* `FIX` [#1476](https://github.com/LuaLS/lua-language-server/issues/1476) +* `FIX` [#1490](https://github.com/LuaLS/lua-language-server/issues/1490) +* `FIX` [#1493](https://github.com/LuaLS/lua-language-server/issues/1493) +* `FIX` [#1499](https://github.com/LuaLS/lua-language-server/issues/1499) +* `FIX` [#1526](https://github.com/LuaLS/lua-language-server/issues/1526) ## 3.5.3 `2022-8-13` -* `FIX` [#1409](https://github.com/sumneko/lua-language-server/issues/1409) -* `FIX` [#1422](https://github.com/sumneko/lua-language-server/issues/1422) -* `FIX` [#1425](https://github.com/sumneko/lua-language-server/issues/1425) -* `FIX` [#1428](https://github.com/sumneko/lua-language-server/issues/1428) -* `FIX` [#1430](https://github.com/sumneko/lua-language-server/issues/1430) -* `FIX` [#1431](https://github.com/sumneko/lua-language-server/issues/1431) -* `FIX` [#1446](https://github.com/sumneko/lua-language-server/issues/1446) -* `FIX` [#1451](https://github.com/sumneko/lua-language-server/issues/1451) -* `FIX` [#1461](https://github.com/sumneko/lua-language-server/issues/1461) -* `FIX` [#1463](https://github.com/sumneko/lua-language-server/issues/1463) +* `FIX` [#1409](https://github.com/LuaLS/lua-language-server/issues/1409) +* `FIX` [#1422](https://github.com/LuaLS/lua-language-server/issues/1422) +* `FIX` [#1425](https://github.com/LuaLS/lua-language-server/issues/1425) +* `FIX` [#1428](https://github.com/LuaLS/lua-language-server/issues/1428) +* `FIX` [#1430](https://github.com/LuaLS/lua-language-server/issues/1430) +* `FIX` [#1431](https://github.com/LuaLS/lua-language-server/issues/1431) +* `FIX` [#1446](https://github.com/LuaLS/lua-language-server/issues/1446) +* `FIX` [#1451](https://github.com/LuaLS/lua-language-server/issues/1451) +* `FIX` [#1461](https://github.com/LuaLS/lua-language-server/issues/1461) +* `FIX` [#1463](https://github.com/LuaLS/lua-language-server/issues/1463) ## 3.5.2 `2022-8-1` -* `FIX` [#1395](https://github.com/sumneko/lua-language-server/issues/1395) -* `FIX` [#1403](https://github.com/sumneko/lua-language-server/issues/1403) -* `FIX` [#1405](https://github.com/sumneko/lua-language-server/issues/1405) -* `FIX` [#1406](https://github.com/sumneko/lua-language-server/issues/1406) -* `FIX` [#1418](https://github.com/sumneko/lua-language-server/issues/1418) +* `FIX` [#1395](https://github.com/LuaLS/lua-language-server/issues/1395) +* `FIX` [#1403](https://github.com/LuaLS/lua-language-server/issues/1403) +* `FIX` [#1405](https://github.com/LuaLS/lua-language-server/issues/1405) +* `FIX` [#1406](https://github.com/LuaLS/lua-language-server/issues/1406) +* `FIX` [#1418](https://github.com/LuaLS/lua-language-server/issues/1418) ## 3.5.1 `2022-7-26` -* `NEW` supports [color](https://github.com/sumneko/lua-language-server/pull/1379) +* `NEW` supports [color](https://github.com/LuaLS/lua-language-server/pull/1379) * `NEW` setting `Lua.runtime.pluginArgs` * `CHG` setting `type.castNumberToInteger` default by `true` * `CHG` improve supports for multi-workspace -* `FIX` [#1354](https://github.com/sumneko/lua-language-server/issues/1354) -* `FIX` [#1355](https://github.com/sumneko/lua-language-server/issues/1355) -* `FIX` [#1363](https://github.com/sumneko/lua-language-server/issues/1363) -* `FIX` [#1365](https://github.com/sumneko/lua-language-server/issues/1365) -* `FIX` [#1367](https://github.com/sumneko/lua-language-server/issues/1367) -* `FIX` [#1368](https://github.com/sumneko/lua-language-server/issues/1368) -* `FIX` [#1370](https://github.com/sumneko/lua-language-server/issues/1370) -* `FIX` [#1375](https://github.com/sumneko/lua-language-server/issues/1375) -* `FIX` [#1391](https://github.com/sumneko/lua-language-server/issues/1391) +* `FIX` [#1354](https://github.com/LuaLS/lua-language-server/issues/1354) +* `FIX` [#1355](https://github.com/LuaLS/lua-language-server/issues/1355) +* `FIX` [#1363](https://github.com/LuaLS/lua-language-server/issues/1363) +* `FIX` [#1365](https://github.com/LuaLS/lua-language-server/issues/1365) +* `FIX` [#1367](https://github.com/LuaLS/lua-language-server/issues/1367) +* `FIX` [#1368](https://github.com/LuaLS/lua-language-server/issues/1368) +* `FIX` [#1370](https://github.com/LuaLS/lua-language-server/issues/1370) +* `FIX` [#1375](https://github.com/LuaLS/lua-language-server/issues/1375) +* `FIX` [#1391](https://github.com/LuaLS/lua-language-server/issues/1391) ## 3.5.0 `2022-7-19` @@ -410,18 +513,18 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. local x ``` * `CHG` signature: only show signatures matching the entered parameters -* `FIX` [#880](https://github.com/sumneko/lua-language-server/issues/880) -* `FIX` [#1284](https://github.com/sumneko/lua-language-server/issues/1284) -* `FIX` [#1292](https://github.com/sumneko/lua-language-server/issues/1292) -* `FIX` [#1294](https://github.com/sumneko/lua-language-server/issues/1294) -* `FIX` [#1306](https://github.com/sumneko/lua-language-server/issues/1306) -* `FIX` [#1311](https://github.com/sumneko/lua-language-server/issues/1311) -* `FIX` [#1317](https://github.com/sumneko/lua-language-server/issues/1317) -* `FIX` [#1320](https://github.com/sumneko/lua-language-server/issues/1320) -* `FIX` [#1330](https://github.com/sumneko/lua-language-server/issues/1330) -* `FIX` [#1345](https://github.com/sumneko/lua-language-server/issues/1345) -* `FIX` [#1346](https://github.com/sumneko/lua-language-server/issues/1346) -* `FIX` [#1348](https://github.com/sumneko/lua-language-server/issues/1348) +* `FIX` [#880](https://github.com/LuaLS/lua-language-server/issues/880) +* `FIX` [#1284](https://github.com/LuaLS/lua-language-server/issues/1284) +* `FIX` [#1292](https://github.com/LuaLS/lua-language-server/issues/1292) +* `FIX` [#1294](https://github.com/LuaLS/lua-language-server/issues/1294) +* `FIX` [#1306](https://github.com/LuaLS/lua-language-server/issues/1306) +* `FIX` [#1311](https://github.com/LuaLS/lua-language-server/issues/1311) +* `FIX` [#1317](https://github.com/LuaLS/lua-language-server/issues/1317) +* `FIX` [#1320](https://github.com/LuaLS/lua-language-server/issues/1320) +* `FIX` [#1330](https://github.com/LuaLS/lua-language-server/issues/1330) +* `FIX` [#1345](https://github.com/LuaLS/lua-language-server/issues/1345) +* `FIX` [#1346](https://github.com/LuaLS/lua-language-server/issues/1346) +* `FIX` [#1348](https://github.com/LuaLS/lua-language-server/issues/1348) ## 3.4.2 `2022-7-6` @@ -430,8 +533,8 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. * `CHG` completion: `completion.callSnippet` no longer generate parameter types * `CHG` hover: show `---@type {x: number, y: number}` as detail instead of `table` * `CHG` dose not infer as `nil` by `t.field = nil` -* `FIX` [#1278](https://github.com/sumneko/lua-language-server/issues/1278) -* `FIX` [#1288](https://github.com/sumneko/lua-language-server/issues/1288) +* `FIX` [#1278](https://github.com/LuaLS/lua-language-server/issues/1278) +* `FIX` [#1288](https://github.com/LuaLS/lua-language-server/issues/1288) ## 3.4.1 `2022-7-5` @@ -445,13 +548,13 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. ---@class B: A local b = setmetatable({}, { __index = a }) -- OK! ``` -* `FIX` [#1256](https://github.com/sumneko/lua-language-server/issues/1256) -* `FIX` [#1257](https://github.com/sumneko/lua-language-server/issues/1257) -* `FIX` [#1267](https://github.com/sumneko/lua-language-server/issues/1267) -* `FIX` [#1269](https://github.com/sumneko/lua-language-server/issues/1269) -* `FIX` [#1273](https://github.com/sumneko/lua-language-server/issues/1273) -* `FIX` [#1275](https://github.com/sumneko/lua-language-server/issues/1275) -* `FIX` [#1279](https://github.com/sumneko/lua-language-server/issues/1279) +* `FIX` [#1256](https://github.com/LuaLS/lua-language-server/issues/1256) +* `FIX` [#1257](https://github.com/LuaLS/lua-language-server/issues/1257) +* `FIX` [#1267](https://github.com/LuaLS/lua-language-server/issues/1267) +* `FIX` [#1269](https://github.com/LuaLS/lua-language-server/issues/1269) +* `FIX` [#1273](https://github.com/LuaLS/lua-language-server/issues/1273) +* `FIX` [#1275](https://github.com/LuaLS/lua-language-server/issues/1275) +* `FIX` [#1279](https://github.com/LuaLS/lua-language-server/issues/1279) ## 3.4.0 `2022-6-29` @@ -499,20 +602,20 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. * `CHG` improve experience for diagnostics and semantic-tokens * `FIX` diagnostics flash when opening a file * `FIX` sometimes workspace diagnostics are not triggered -* `FIX` [#1228](https://github.com/sumneko/lua-language-server/issues/1228) -* `FIX` [#1229](https://github.com/sumneko/lua-language-server/issues/1229) -* `FIX` [#1242](https://github.com/sumneko/lua-language-server/issues/1242) -* `FIX` [#1243](https://github.com/sumneko/lua-language-server/issues/1243) -* `FIX` [#1249](https://github.com/sumneko/lua-language-server/issues/1249) +* `FIX` [#1228](https://github.com/LuaLS/lua-language-server/issues/1228) +* `FIX` [#1229](https://github.com/LuaLS/lua-language-server/issues/1229) +* `FIX` [#1242](https://github.com/LuaLS/lua-language-server/issues/1242) +* `FIX` [#1243](https://github.com/LuaLS/lua-language-server/issues/1243) +* `FIX` [#1249](https://github.com/LuaLS/lua-language-server/issues/1249) ## 3.3.1 `2022-6-17` -* `FIX` [#1213](https://github.com/sumneko/lua-language-server/issues/1213) -* `FIX` [#1215](https://github.com/sumneko/lua-language-server/issues/1215) -* `FIX` [#1217](https://github.com/sumneko/lua-language-server/issues/1217) -* `FIX` [#1218](https://github.com/sumneko/lua-language-server/issues/1218) -* `FIX` [#1220](https://github.com/sumneko/lua-language-server/issues/1220) -* `FIX` [#1223](https://github.com/sumneko/lua-language-server/issues/1223) +* `FIX` [#1213](https://github.com/LuaLS/lua-language-server/issues/1213) +* `FIX` [#1215](https://github.com/LuaLS/lua-language-server/issues/1215) +* `FIX` [#1217](https://github.com/LuaLS/lua-language-server/issues/1217) +* `FIX` [#1218](https://github.com/LuaLS/lua-language-server/issues/1218) +* `FIX` [#1220](https://github.com/LuaLS/lua-language-server/issues/1220) +* `FIX` [#1223](https://github.com/LuaLS/lua-language-server/issues/1223) ## 3.3.0 `2022-6-15` @@ -557,15 +660,15 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. ``` * `CHG` infer type by `>`/`<`/`>=`/`<=` * `FIX` with clients that support LSP 3.17 (VSCode), workspace diagnostics are triggered every time when opening a file. -* `FIX` [#1204](https://github.com/sumneko/lua-language-server/issues/1204) -* `FIX` [#1208](https://github.com/sumneko/lua-language-server/issues/1208) +* `FIX` [#1204](https://github.com/LuaLS/lua-language-server/issues/1204) +* `FIX` [#1208](https://github.com/LuaLS/lua-language-server/issues/1208) ## 3.2.5 `2022-6-9` * `NEW` provide config docs in `LUA_LANGUAGE_SERVER/doc/` -* `FIX` [#1148](https://github.com/sumneko/lua-language-server/issues/1148) -* `FIX` [#1149](https://github.com/sumneko/lua-language-server/issues/1149) -* `FIX` [#1192](https://github.com/sumneko/lua-language-server/issues/1192) +* `FIX` [#1148](https://github.com/LuaLS/lua-language-server/issues/1148) +* `FIX` [#1149](https://github.com/LuaLS/lua-language-server/issues/1149) +* `FIX` [#1192](https://github.com/LuaLS/lua-language-server/issues/1192) ## 3.2.4 `2022-5-25` @@ -577,13 +680,13 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. * `CHG` show warning message when scanning more than 100,000 files. * `CHG` upgrade [LSP](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/) to `3.17` * `FIX` hover: can not union `table` with other basic types -* `FIX` [#1125](https://github.com/sumneko/lua-language-server/issues/1125) -* `FIX` [#1131](https://github.com/sumneko/lua-language-server/issues/1131) -* `FIX` [#1134](https://github.com/sumneko/lua-language-server/issues/1134) -* `FIX` [#1141](https://github.com/sumneko/lua-language-server/issues/1141) -* `FIX` [#1144](https://github.com/sumneko/lua-language-server/issues/1144) -* `FIX` [#1150](https://github.com/sumneko/lua-language-server/issues/1150) -* `FIX` [#1155](https://github.com/sumneko/lua-language-server/issues/1155) +* `FIX` [#1125](https://github.com/LuaLS/lua-language-server/issues/1125) +* `FIX` [#1131](https://github.com/LuaLS/lua-language-server/issues/1131) +* `FIX` [#1134](https://github.com/LuaLS/lua-language-server/issues/1134) +* `FIX` [#1141](https://github.com/LuaLS/lua-language-server/issues/1141) +* `FIX` [#1144](https://github.com/LuaLS/lua-language-server/issues/1144) +* `FIX` [#1150](https://github.com/LuaLS/lua-language-server/issues/1150) +* `FIX` [#1155](https://github.com/LuaLS/lua-language-server/issues/1155) ## 3.2.3 `2022-5-16` @@ -591,15 +694,15 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. * `CHG` dose not load files in symbol links * `FIX` memory leak with symbol links * `FIX` diagnostic: send empty results to every file after startup -* `FIX` [#1103](https://github.com/sumneko/lua-language-server/issues/1103) -* `FIX` [#1107](https://github.com/sumneko/lua-language-server/issues/1107) +* `FIX` [#1103](https://github.com/LuaLS/lua-language-server/issues/1103) +* `FIX` [#1107](https://github.com/LuaLS/lua-language-server/issues/1107) ## 3.2.2 `2022-4-26` * `FIX` diagnostic: `unused-function` cannot handle recursion correctly -* `FIX` [#1092](https://github.com/sumneko/lua-language-server/issues/1092) -* `FIX` [#1093](https://github.com/sumneko/lua-language-server/issues/1093) -* `FIX` runtime errors reported by telemetry, see [#1091](https://github.com/sumneko/lua-language-server/issues/1091) +* `FIX` [#1092](https://github.com/LuaLS/lua-language-server/issues/1092) +* `FIX` [#1093](https://github.com/LuaLS/lua-language-server/issues/1093) +* `FIX` runtime errors reported by telemetry, see [#1091](https://github.com/LuaLS/lua-language-server/issues/1091) ## 3.2.1 `2022-4-25` @@ -641,10 +744,10 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. * `NEW` diagnostic: `need-check-nil` * `CHG` diagnostic: no longer mark `redundant-parameter` as `Unnecessary` * `FIX` diagnostic: `unused-function` does not recognize recursion -* `FIX` [#1051](https://github.com/sumneko/lua-language-server/issues/1051) -* `FIX` [#1072](https://github.com/sumneko/lua-language-server/issues/1072) -* `FIX` [#1077](https://github.com/sumneko/lua-language-server/issues/1077) -* `FIX` [#1088](https://github.com/sumneko/lua-language-server/issues/1088) +* `FIX` [#1051](https://github.com/LuaLS/lua-language-server/issues/1051) +* `FIX` [#1072](https://github.com/LuaLS/lua-language-server/issues/1072) +* `FIX` [#1077](https://github.com/LuaLS/lua-language-server/issues/1077) +* `FIX` [#1088](https://github.com/LuaLS/lua-language-server/issues/1088) * `FIX` runtime errors ## 3.1.0 @@ -654,90 +757,90 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. * `CHG` hover: split `local` into `local` / `parameter` / `upvalue` / `self`. * `CHG` hover: added parentheses to some words, such as `global` / `field` / `class`. * `FIX` definition of `table<k, v>` -* `FIX` [#994](https://github.com/sumneko/lua-language-server/issues/994) -* `FIX` [#1057](https://github.com/sumneko/lua-language-server/issues/1057) -* `FIX` runtime errors reported by telemetry, see [#1058](https://github.com/sumneko/lua-language-server/issues/1058) +* `FIX` [#994](https://github.com/LuaLS/lua-language-server/issues/994) +* `FIX` [#1057](https://github.com/LuaLS/lua-language-server/issues/1057) +* `FIX` runtime errors reported by telemetry, see [#1058](https://github.com/LuaLS/lua-language-server/issues/1058) ## 3.0.2 `2022-4-15` * `FIX` `table<string, boolean>[string] -> boolean` * `FIX` goto `type definition` -* `FIX` [#1050](https://github.com/sumneko/lua-language-server/issues/1050) +* `FIX` [#1050](https://github.com/LuaLS/lua-language-server/issues/1050) ## 3.0.1 `2022-4-11` -* `FIX` [#1033](https://github.com/sumneko/lua-language-server/issues/1033) -* `FIX` [#1034](https://github.com/sumneko/lua-language-server/issues/1034) -* `FIX` [#1035](https://github.com/sumneko/lua-language-server/issues/1035) -* `FIX` [#1036](https://github.com/sumneko/lua-language-server/issues/1036) -* `FIX` runtime errors reported by telemetry, see [#1037](https://github.com/sumneko/lua-language-server/issues/1037) +* `FIX` [#1033](https://github.com/LuaLS/lua-language-server/issues/1033) +* `FIX` [#1034](https://github.com/LuaLS/lua-language-server/issues/1034) +* `FIX` [#1035](https://github.com/LuaLS/lua-language-server/issues/1035) +* `FIX` [#1036](https://github.com/LuaLS/lua-language-server/issues/1036) +* `FIX` runtime errors reported by telemetry, see [#1037](https://github.com/LuaLS/lua-language-server/issues/1037) ## 3.0.0 `2022-4-10` -* `CHG` [break changes](https://github.com/sumneko/lua-language-server/issues/980) +* `CHG` [break changes](https://github.com/LuaLS/lua-language-server/issues/980) * `CHG` diagnostic: + `type-check`: removed for now + `no-implicit-any`: renamed to `no-unknown` * `CHG` formatter: no longer need` --preview` * `CHG` `LuaDoc`: supports `---@type (string|integer)[]` * `FIX` semantic: color of `function` -* `FIX` [#1027](https://github.com/sumneko/lua-language-server/issues/1027) -* `FIX` [#1028](https://github.com/sumneko/lua-language-server/issues/1028) +* `FIX` [#1027](https://github.com/LuaLS/lua-language-server/issues/1027) +* `FIX` [#1028](https://github.com/LuaLS/lua-language-server/issues/1028) ## 2.6.8 `2022-4-9` * `CHG` completion: call snippet shown as `Function` instead of `Snippet` when `Lua.completion.callSnippet` is `Replace` -* `FIX` [#976](https://github.com/sumneko/lua-language-server/issues/976) -* `FIX` [#995](https://github.com/sumneko/lua-language-server/issues/995) -* `FIX` [#1004](https://github.com/sumneko/lua-language-server/issues/1004) -* `FIX` [#1008](https://github.com/sumneko/lua-language-server/issues/1008) -* `FIX` [#1009](https://github.com/sumneko/lua-language-server/issues/1009) -* `FIX` [#1011](https://github.com/sumneko/lua-language-server/issues/1011) -* `FIX` [#1014](https://github.com/sumneko/lua-language-server/issues/1014) -* `FIX` [#1016](https://github.com/sumneko/lua-language-server/issues/1016) -* `FIX` [#1017](https://github.com/sumneko/lua-language-server/issues/1017) +* `FIX` [#976](https://github.com/LuaLS/lua-language-server/issues/976) +* `FIX` [#995](https://github.com/LuaLS/lua-language-server/issues/995) +* `FIX` [#1004](https://github.com/LuaLS/lua-language-server/issues/1004) +* `FIX` [#1008](https://github.com/LuaLS/lua-language-server/issues/1008) +* `FIX` [#1009](https://github.com/LuaLS/lua-language-server/issues/1009) +* `FIX` [#1011](https://github.com/LuaLS/lua-language-server/issues/1011) +* `FIX` [#1014](https://github.com/LuaLS/lua-language-server/issues/1014) +* `FIX` [#1016](https://github.com/LuaLS/lua-language-server/issues/1016) +* `FIX` [#1017](https://github.com/LuaLS/lua-language-server/issues/1017) * `FIX` runtime errors reported by telemetry ## 2.6.7 `2022-3-9` -* `NEW` offline diagnostic, [read more](https://github.com/sumneko/lua-language-server/wiki/Offline-Diagnostic) -* `CHG` `VSCode`: 1.65 has built in new `Lua` syntax files, so this extension no longer provides syntax files, which means you can install other syntax extensions in the marketplace. If you have any suggestions or issues, please [open issues here](https://github.com/sumneko/lua.tmbundle). +* `NEW` offline diagnostic, [read more](https://github.com/LuaLS/lua-language-server/wiki/Offline-Diagnostic) +* `CHG` `VSCode`: 1.65 has built in new `Lua` syntax files, so this extension no longer provides syntax files, which means you can install other syntax extensions in the marketplace. If you have any suggestions or issues, please [open issues here](https://github.com/LuaLS/lua.tmbundle). * `CHG` telemetry: the prompt will only appear in VSCode to avoid repeated prompts in other platforms due to the inability to automatically modify the settings. -* `FIX` [#965](https://github.com/sumneko/lua-language-server/issues/965) -* `FIX` [#975](https://github.com/sumneko/lua-language-server/issues/975) +* `FIX` [#965](https://github.com/LuaLS/lua-language-server/issues/965) +* `FIX` [#975](https://github.com/LuaLS/lua-language-server/issues/975) ## 2.6.6 `2022-2-21` -* `NEW` formatter preview, use `--preview` to enable this feature, [read more](https://github.com/sumneko/lua-language-server/issues/960) -* `FIX` [#958](https://github.com/sumneko/lua-language-server/issues/958) +* `NEW` formatter preview, use `--preview` to enable this feature, [read more](https://github.com/LuaLS/lua-language-server/issues/960) +* `FIX` [#958](https://github.com/LuaLS/lua-language-server/issues/958) * `FIX` runtime errors ## 2.6.5 `2022-2-17` * `FIX` telemetry is not disabled by default (since 2.6.0) -* `FIX` [#934](https://github.com/sumneko/lua-language-server/issues/934) -* `FIX` [#952](https://github.com/sumneko/lua-language-server/issues/952) +* `FIX` [#934](https://github.com/LuaLS/lua-language-server/issues/934) +* `FIX` [#952](https://github.com/LuaLS/lua-language-server/issues/952) ## 2.6.4 `2022-2-9` * `CHG` completion: reduced sorting priority for postfix completion -* `FIX` [#936](https://github.com/sumneko/lua-language-server/issues/936) -* `FIX` [#937](https://github.com/sumneko/lua-language-server/issues/937) -* `FIX` [#940](https://github.com/sumneko/lua-language-server/issues/940) -* `FIX` [#941](https://github.com/sumneko/lua-language-server/issues/941) -* `FIX` [#941](https://github.com/sumneko/lua-language-server/issues/942) -* `FIX` [#943](https://github.com/sumneko/lua-language-server/issues/943) -* `FIX` [#946](https://github.com/sumneko/lua-language-server/issues/946) +* `FIX` [#936](https://github.com/LuaLS/lua-language-server/issues/936) +* `FIX` [#937](https://github.com/LuaLS/lua-language-server/issues/937) +* `FIX` [#940](https://github.com/LuaLS/lua-language-server/issues/940) +* `FIX` [#941](https://github.com/LuaLS/lua-language-server/issues/941) +* `FIX` [#941](https://github.com/LuaLS/lua-language-server/issues/942) +* `FIX` [#943](https://github.com/LuaLS/lua-language-server/issues/943) +* `FIX` [#946](https://github.com/LuaLS/lua-language-server/issues/946) ## 2.6.3 `2022-1-25` * `FIX` new files are not loaded correctly -* `FIX` [#923](https://github.com/sumneko/lua-language-server/issues/923) -* `FIX` [#926](https://github.com/sumneko/lua-language-server/issues/926) +* `FIX` [#923](https://github.com/LuaLS/lua-language-server/issues/923) +* `FIX` [#926](https://github.com/LuaLS/lua-language-server/issues/926) ## 2.6.2 `2022-1-25` -* `FIX` [#925](https://github.com/sumneko/lua-language-server/issues/925) +* `FIX` [#925](https://github.com/LuaLS/lua-language-server/issues/925) ## 2.6.1 `2022-1-24` @@ -748,13 +851,13 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. * `CHG` improve performance * `FIX` modify luarc failed * `FIX` library files not recognized correctly -* `FIX` [#903](https://github.com/sumneko/lua-language-server/issues/903) -* `FIX` [#906](https://github.com/sumneko/lua-language-server/issues/906) -* `FIX` [#920](https://github.com/sumneko/lua-language-server/issues/920) +* `FIX` [#903](https://github.com/LuaLS/lua-language-server/issues/903) +* `FIX` [#906](https://github.com/LuaLS/lua-language-server/issues/906) +* `FIX` [#920](https://github.com/LuaLS/lua-language-server/issues/920) ## 2.6.0 `2022-1-13` -* `NEW` supports multi-workspace in server side, for developers of language clients, please [read here](https://github.com/sumneko/lua-language-server/wiki/Multi-workspace-supports) to learn more. +* `NEW` supports multi-workspace in server side, for developers of language clients, please [read here](https://github.com/LuaLS/lua-language-server/wiki/Multi-workspace-supports) to learn more. * `NEW` setting: + `Lua.hint.arrayIndex` + `Lua.semantic.enable` @@ -765,17 +868,17 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. * `CHG` completion: can be triggered in `LuaDoc` and strings * `CHG` diagnostic: smoother * `CHG` settings `Lua.color.mode` removed -* `FIX` [#876](https://github.com/sumneko/lua-language-server/issues/876) -* `FIX` [#879](https://github.com/sumneko/lua-language-server/issues/879) -* `FIX` [#884](https://github.com/sumneko/lua-language-server/issues/884) -* `FIX` [#885](https://github.com/sumneko/lua-language-server/issues/885) -* `FIX` [#886](https://github.com/sumneko/lua-language-server/issues/886) -* `FIX` [#902](https://github.com/sumneko/lua-language-server/issues/902) +* `FIX` [#876](https://github.com/LuaLS/lua-language-server/issues/876) +* `FIX` [#879](https://github.com/LuaLS/lua-language-server/issues/879) +* `FIX` [#884](https://github.com/LuaLS/lua-language-server/issues/884) +* `FIX` [#885](https://github.com/LuaLS/lua-language-server/issues/885) +* `FIX` [#886](https://github.com/LuaLS/lua-language-server/issues/886) +* `FIX` [#902](https://github.com/LuaLS/lua-language-server/issues/902) ## 2.5.6 `2021-12-27` * `CHG` diagnostic: now syntax errors in `LuaDoc` are shown as `Warning` -* `FIX` [#863](https://github.com/sumneko/lua-language-server/issues/863) +* `FIX` [#863](https://github.com/LuaLS/lua-language-server/issues/863) * `FIX` return type of `math.floor` * `FIX` runtime errors @@ -785,25 +888,25 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. ## 2.5.4 `2021-12-16` -* `FIX` [#847](https://github.com/sumneko/lua-language-server/issues/847) -* `FIX` [#848](https://github.com/sumneko/lua-language-server/issues/848) +* `FIX` [#847](https://github.com/LuaLS/lua-language-server/issues/847) +* `FIX` [#848](https://github.com/LuaLS/lua-language-server/issues/848) * `FIX` completion: incorrect cache * `FIX` hover: always view string ## 2.5.3 `2021-12-6` -* `FIX` [#842](https://github.com/sumneko/lua-language-server/issues/844) -* `FIX` [#844](https://github.com/sumneko/lua-language-server/issues/844) +* `FIX` [#842](https://github.com/LuaLS/lua-language-server/issues/844) +* `FIX` [#844](https://github.com/LuaLS/lua-language-server/issues/844) ## 2.5.2 `2021-12-2` -* `FIX` [#815](https://github.com/sumneko/lua-language-server/issues/815) -* `FIX` [#825](https://github.com/sumneko/lua-language-server/issues/825) -* `FIX` [#826](https://github.com/sumneko/lua-language-server/issues/826) -* `FIX` [#827](https://github.com/sumneko/lua-language-server/issues/827) -* `FIX` [#831](https://github.com/sumneko/lua-language-server/issues/831) -* `FIX` [#837](https://github.com/sumneko/lua-language-server/issues/837) -* `FIX` [#838](https://github.com/sumneko/lua-language-server/issues/838) +* `FIX` [#815](https://github.com/LuaLS/lua-language-server/issues/815) +* `FIX` [#825](https://github.com/LuaLS/lua-language-server/issues/825) +* `FIX` [#826](https://github.com/LuaLS/lua-language-server/issues/826) +* `FIX` [#827](https://github.com/LuaLS/lua-language-server/issues/827) +* `FIX` [#831](https://github.com/LuaLS/lua-language-server/issues/831) +* `FIX` [#837](https://github.com/LuaLS/lua-language-server/issues/837) +* `FIX` [#838](https://github.com/LuaLS/lua-language-server/issues/838) * `FIX` postfix * `FIX` runtime errors @@ -819,7 +922,7 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. + `Lua.completion.postfix`: the symbol that triggers postfix, default is `@` * `NEW` add supports for `lovr` * `NEW` file encoding supports `utf16le` and `utf16be` -* `NEW` full IntelliSense supports for literal tables, see [#720](https://github.com/sumneko/lua-language-server/issues/720) and [#727](https://github.com/sumneko/lua-language-server/issues/727) +* `NEW` full IntelliSense supports for literal tables, see [#720](https://github.com/LuaLS/lua-language-server/issues/720) and [#727](https://github.com/LuaLS/lua-language-server/issues/727) * `NEW` `LuaDoc` annotations: + `---@async`: mark a function as async + `---@nodiscard`: the return value of the marking function cannot be discarded @@ -844,20 +947,20 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. ## 2.4.11 `2021-11-25` -* `FIX` [#816](https://github.com/sumneko/lua-language-server/issues/816) -* `FIX` [#817](https://github.com/sumneko/lua-language-server/issues/817) -* `FIX` [#818](https://github.com/sumneko/lua-language-server/issues/818) -* `FIX` [#820](https://github.com/sumneko/lua-language-server/issues/820) +* `FIX` [#816](https://github.com/LuaLS/lua-language-server/issues/816) +* `FIX` [#817](https://github.com/LuaLS/lua-language-server/issues/817) +* `FIX` [#818](https://github.com/LuaLS/lua-language-server/issues/818) +* `FIX` [#820](https://github.com/LuaLS/lua-language-server/issues/820) ## 2.4.10 `2021-11-23` -* `FIX` [#790](https://github.com/sumneko/lua-language-server/issues/790) -* `FIX` [#798](https://github.com/sumneko/lua-language-server/issues/798) -* `FIX` [#804](https://github.com/sumneko/lua-language-server/issues/804) -* `FIX` [#805](https://github.com/sumneko/lua-language-server/issues/805) -* `FIX` [#806](https://github.com/sumneko/lua-language-server/issues/806) -* `FIX` [#807](https://github.com/sumneko/lua-language-server/issues/807) -* `FIX` [#809](https://github.com/sumneko/lua-language-server/issues/809) +* `FIX` [#790](https://github.com/LuaLS/lua-language-server/issues/790) +* `FIX` [#798](https://github.com/LuaLS/lua-language-server/issues/798) +* `FIX` [#804](https://github.com/LuaLS/lua-language-server/issues/804) +* `FIX` [#805](https://github.com/LuaLS/lua-language-server/issues/805) +* `FIX` [#806](https://github.com/LuaLS/lua-language-server/issues/806) +* `FIX` [#807](https://github.com/LuaLS/lua-language-server/issues/807) +* `FIX` [#809](https://github.com/LuaLS/lua-language-server/issues/809) ## 2.4.9 `2021-11-18` @@ -867,31 +970,31 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. + `Lua.IntelliSense.traceBeSetted` + `Lua.IntelliSense.traceFieldInject` - [read more](https://github.com/sumneko/lua-language-server/wiki/IntelliSense-optional-features) + [read more](https://github.com/LuaLS/lua-language-server/wiki/IntelliSense-optional-features) ## 2.4.8 `2021-11-15` * `FIX` incorrect IntelliSense in specific situations -* `FIX` [#777](https://github.com/sumneko/lua-language-server/issues/777) -* `FIX` [#778](https://github.com/sumneko/lua-language-server/issues/778) -* `FIX` [#779](https://github.com/sumneko/lua-language-server/issues/779) -* `FIX` [#780](https://github.com/sumneko/lua-language-server/issues/780) +* `FIX` [#777](https://github.com/LuaLS/lua-language-server/issues/777) +* `FIX` [#778](https://github.com/LuaLS/lua-language-server/issues/778) +* `FIX` [#779](https://github.com/LuaLS/lua-language-server/issues/779) +* `FIX` [#780](https://github.com/LuaLS/lua-language-server/issues/780) ## 2.4.7 `2021-10-27` -* `FIX` [#762](https://github.com/sumneko/lua-language-server/issues/762) +* `FIX` [#762](https://github.com/LuaLS/lua-language-server/issues/762) ## 2.4.6 `2021-10-26` * `NEW` diagnostic: `redundant-return` -* `FIX` [#744](https://github.com/sumneko/lua-language-server/issues/744) -* `FIX` [#748](https://github.com/sumneko/lua-language-server/issues/748) -* `FIX` [#749](https://github.com/sumneko/lua-language-server/issues/749) -* `FIX` [#752](https://github.com/sumneko/lua-language-server/issues/752) -* `FIX` [#753](https://github.com/sumneko/lua-language-server/issues/753) -* `FIX` [#756](https://github.com/sumneko/lua-language-server/issues/756) -* `FIX` [#758](https://github.com/sumneko/lua-language-server/issues/758) -* `FIX` [#760](https://github.com/sumneko/lua-language-server/issues/760) +* `FIX` [#744](https://github.com/LuaLS/lua-language-server/issues/744) +* `FIX` [#748](https://github.com/LuaLS/lua-language-server/issues/748) +* `FIX` [#749](https://github.com/LuaLS/lua-language-server/issues/749) +* `FIX` [#752](https://github.com/LuaLS/lua-language-server/issues/752) +* `FIX` [#753](https://github.com/LuaLS/lua-language-server/issues/753) +* `FIX` [#756](https://github.com/LuaLS/lua-language-server/issues/756) +* `FIX` [#758](https://github.com/LuaLS/lua-language-server/issues/758) +* `FIX` [#760](https://github.com/LuaLS/lua-language-server/issues/760) ## 2.4.5 `2021-10-18` @@ -900,31 +1003,31 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. ## 2.4.4 `2021-10-15` * `CHG` improve `.luarc.json` -* `FIX` [#722](https://github.com/sumneko/lua-language-server/issues/722) +* `FIX` [#722](https://github.com/LuaLS/lua-language-server/issues/722) ## 2.4.3 `2021-10-13` -* `FIX` [#713](https://github.com/sumneko/lua-language-server/issues/713) -* `FIX` [#718](https://github.com/sumneko/lua-language-server/issues/718) -* `FIX` [#719](https://github.com/sumneko/lua-language-server/issues/719) -* `FIX` [#725](https://github.com/sumneko/lua-language-server/issues/725) -* `FIX` [#729](https://github.com/sumneko/lua-language-server/issues/729) -* `FIX` [#730](https://github.com/sumneko/lua-language-server/issues/730) +* `FIX` [#713](https://github.com/LuaLS/lua-language-server/issues/713) +* `FIX` [#718](https://github.com/LuaLS/lua-language-server/issues/718) +* `FIX` [#719](https://github.com/LuaLS/lua-language-server/issues/719) +* `FIX` [#725](https://github.com/LuaLS/lua-language-server/issues/725) +* `FIX` [#729](https://github.com/LuaLS/lua-language-server/issues/729) +* `FIX` [#730](https://github.com/LuaLS/lua-language-server/issues/730) * `FIX` runtime errors ## 2.4.2 `2021-10-8` -* `FIX` [#702](https://github.com/sumneko/lua-language-server/issues/702) -* `FIX` [#706](https://github.com/sumneko/lua-language-server/issues/706) -* `FIX` [#707](https://github.com/sumneko/lua-language-server/issues/707) -* `FIX` [#709](https://github.com/sumneko/lua-language-server/issues/709) -* `FIX` [#712](https://github.com/sumneko/lua-language-server/issues/712) +* `FIX` [#702](https://github.com/LuaLS/lua-language-server/issues/702) +* `FIX` [#706](https://github.com/LuaLS/lua-language-server/issues/706) +* `FIX` [#707](https://github.com/LuaLS/lua-language-server/issues/707) +* `FIX` [#709](https://github.com/LuaLS/lua-language-server/issues/709) +* `FIX` [#712](https://github.com/LuaLS/lua-language-server/issues/712) ## 2.4.1 `2021-10-2` * `FIX` broken with single file -* `FIX` [#698](https://github.com/sumneko/lua-language-server/issues/698) -* `FIX` [#699](https://github.com/sumneko/lua-language-server/issues/699) +* `FIX` [#698](https://github.com/LuaLS/lua-language-server/issues/698) +* `FIX` [#699](https://github.com/LuaLS/lua-language-server/issues/699) ## 2.4.0 `2021-10-1` @@ -977,18 +1080,18 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. + `redundant-parameter` default severity to `Warning` + `redundant-value` default severity to `Warning` * `CHG` infer: more strict of calculation results -* `CHG` [#663](https://github.com/sumneko/lua-language-server/issues/663) +* `CHG` [#663](https://github.com/LuaLS/lua-language-server/issues/663) * `FIX` runtime errors * `FIX` hint: may show param-2 as `self` * `FIX` semantic: may fail when scrolling -* `FIX` [#647](https://github.com/sumneko/lua-language-server/issues/647) -* `FIX` [#660](https://github.com/sumneko/lua-language-server/issues/660) -* `FIX` [#673](https://github.com/sumneko/lua-language-server/issues/673) +* `FIX` [#647](https://github.com/LuaLS/lua-language-server/issues/647) +* `FIX` [#660](https://github.com/LuaLS/lua-language-server/issues/660) +* `FIX` [#673](https://github.com/LuaLS/lua-language-server/issues/673) ## 2.3.7 `2021-8-17` * `CHG` improve performance -* `FIX` [#244](https://github.com/sumneko/lua-language-server/issues/244) +* `FIX` [#244](https://github.com/LuaLS/lua-language-server/issues/244) ## 2.3.6 `2021-8-9` @@ -1004,15 +1107,15 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. ## 2.3.4 `2021-8-6` * `CHG` improve performance -* `FIX` [#625](https://github.com/sumneko/lua-language-server/issues/625) +* `FIX` [#625](https://github.com/LuaLS/lua-language-server/issues/625) ## 2.3.3 `2021-7-26` * `NEW` config supports prop -* `FIX` [#612](https://github.com/sumneko/lua-language-server/issues/612) -* `FIX` [#613](https://github.com/sumneko/lua-language-server/issues/613) -* `FIX` [#618](https://github.com/sumneko/lua-language-server/issues/618) -* `FIX` [#620](https://github.com/sumneko/lua-language-server/issues/620) +* `FIX` [#612](https://github.com/LuaLS/lua-language-server/issues/612) +* `FIX` [#613](https://github.com/LuaLS/lua-language-server/issues/613) +* `FIX` [#618](https://github.com/LuaLS/lua-language-server/issues/618) +* `FIX` [#620](https://github.com/LuaLS/lua-language-server/issues/620) ## 2.3.2 `2021-7-21` @@ -1029,12 +1132,12 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. ## 2.3.1 `2021-7-19` -* `NEW` setting `Lua.workspace.userThirdParty`, add private user [third-parth](https://github.com/sumneko/lua-language-server/tree/master/meta/3rd) by this setting +* `NEW` setting `Lua.workspace.userThirdParty`, add private user [third-parth](https://github.com/LuaLS/lua-language-server/tree/master/meta/3rd) by this setting * `CHG` path in config supports `~/xxxx` * `FIX` `autoRequire` inserted incorrect code * `FIX` `autoRequire` may provide dumplicated options -* `FIX` [#606](https://github.com/sumneko/lua-language-server/issues/606) -* `FIX` [#607](https://github.com/sumneko/lua-language-server/issues/607) +* `FIX` [#606](https://github.com/LuaLS/lua-language-server/issues/606) +* `FIX` [#607](https://github.com/LuaLS/lua-language-server/issues/607) ## 2.3.0 `2021-7-16` @@ -1069,10 +1172,10 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. * `FIX` completion: displaying `@fenv` in `Lua 5.1` * `FIX` completion: incorrect at end of line * `FIX` when a file is renamed, the file will still be loaded even if the new file name has been set to ignore -* `FIX` [#596](https://github.com/sumneko/lua-language-server/issues/596) -* `FIX` [#597](https://github.com/sumneko/lua-language-server/issues/597) -* `FIX` [#598](https://github.com/sumneko/lua-language-server/issues/598) -* `FIX` [#601](https://github.com/sumneko/lua-language-server/issues/601) +* `FIX` [#596](https://github.com/LuaLS/lua-language-server/issues/596) +* `FIX` [#597](https://github.com/LuaLS/lua-language-server/issues/597) +* `FIX` [#598](https://github.com/LuaLS/lua-language-server/issues/598) +* `FIX` [#601](https://github.com/LuaLS/lua-language-server/issues/601) ## 2.2.3 `2021-7-9` @@ -1080,7 +1183,7 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. * `CHG` will not sleep anymore * `FIX` incorrect doc: `debug.getlocal` * `FIX` completion: incorrect callback -* `FIX` [#592](https://github.com/sumneko/lua-language-server/issues/592) +* `FIX` [#592](https://github.com/LuaLS/lua-language-server/issues/592) ## 2.2.2 `2021-7-9` @@ -1121,7 +1224,7 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. ## 2.1.0 `2021-7-2` -* `NEW` supports local config file, using `--configpath="config.json"`, [learn more here](https://github.com/sumneko/lua-language-server/wiki/Setting-without-VSCode) +* `NEW` supports local config file, using `--configpath="config.json"`, [learn more here](https://github.com/LuaLS/lua-language-server/wiki/Setting-without-VSCode) * `NEW` goto `type definition` * `NEW` infer type by callback param: ```lua @@ -1134,7 +1237,7 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. end) ``` * `NEW` optional field `---@field name? type` -* `CHG` [#549](https://github.com/sumneko/lua-language-server/issues/549) +* `CHG` [#549](https://github.com/LuaLS/lua-language-server/issues/549) * `CHG` diagnostics: always ignore the ignored files even if they are opened * `FIX` completion: `type() ==` may does not work @@ -1155,20 +1258,20 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. end ``` * `CHG` improve performance -* `FIX` [#580](https://github.com/sumneko/lua-language-server/issues/580) +* `FIX` [#580](https://github.com/LuaLS/lua-language-server/issues/580) ## 2.0.4 `2021-6-25` -* `FIX` [#550](https://github.com/sumneko/lua-language-server/issues/550) -* `FIX` [#555](https://github.com/sumneko/lua-language-server/issues/555) -* `FIX` [#574](https://github.com/sumneko/lua-language-server/issues/574) +* `FIX` [#550](https://github.com/LuaLS/lua-language-server/issues/550) +* `FIX` [#555](https://github.com/LuaLS/lua-language-server/issues/555) +* `FIX` [#574](https://github.com/LuaLS/lua-language-server/issues/574) ## 2.0.3 `2021-6-24` * `CHG` improve memory usage * `FIX` some dialog boxes block the initialization process * `FIX` diagnostics `undefined-field`: blocks main thread -* `FIX` [#565](https://github.com/sumneko/lua-language-server/issues/565) +* `FIX` [#565](https://github.com/LuaLS/lua-language-server/issues/565) ## 2.0.2 `2021-6-23` @@ -1187,15 +1290,15 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. ---after local f: fun(x: number): boolean ``` -* `FIX` [#558](https://github.com/sumneko/lua-language-server/issues/558) -* `FIX` [#567](https://github.com/sumneko/lua-language-server/issues/567) -* `FIX` [#568](https://github.com/sumneko/lua-language-server/issues/568) -* `FIX` [#570](https://github.com/sumneko/lua-language-server/issues/570) -* `FIX` [#571](https://github.com/sumneko/lua-language-server/issues/571) +* `FIX` [#558](https://github.com/LuaLS/lua-language-server/issues/558) +* `FIX` [#567](https://github.com/LuaLS/lua-language-server/issues/567) +* `FIX` [#568](https://github.com/LuaLS/lua-language-server/issues/568) +* `FIX` [#570](https://github.com/LuaLS/lua-language-server/issues/570) +* `FIX` [#571](https://github.com/LuaLS/lua-language-server/issues/571) ## 2.0.1 `2021-6-21` -* `FIX` [#566](https://github.com/sumneko/lua-language-server/issues/566) +* `FIX` [#566](https://github.com/LuaLS/lua-language-server/issues/566) ## 2.0.0 `2021-6-21` @@ -1205,14 +1308,14 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. * `CHG` setting `Lua.intelliSense.searchDepth`: removed * `CHG` setting `Lua.misc.parameters`: `string array` instead of `string` * `CHG` setting `Lua.develop.enable`, `Lua.develop.debuggerPort`, `Lua.develop.debuggerWait`: removed, use `Lua.misc.parameters` instead -* `FIX` [#441](https://github.com/sumneko/lua-language-server/issues/441) -* `FIX` [#493](https://github.com/sumneko/lua-language-server/issues/493) -* `FIX` [#531](https://github.com/sumneko/lua-language-server/issues/531) -* `FIX` [#542](https://github.com/sumneko/lua-language-server/issues/542) -* `FIX` [#543](https://github.com/sumneko/lua-language-server/issues/543) -* `FIX` [#553](https://github.com/sumneko/lua-language-server/issues/553) -* `FIX` [#562](https://github.com/sumneko/lua-language-server/issues/562) -* `FIX` [#563](https://github.com/sumneko/lua-language-server/issues/563) +* `FIX` [#441](https://github.com/LuaLS/lua-language-server/issues/441) +* `FIX` [#493](https://github.com/LuaLS/lua-language-server/issues/493) +* `FIX` [#531](https://github.com/LuaLS/lua-language-server/issues/531) +* `FIX` [#542](https://github.com/LuaLS/lua-language-server/issues/542) +* `FIX` [#543](https://github.com/LuaLS/lua-language-server/issues/543) +* `FIX` [#553](https://github.com/LuaLS/lua-language-server/issues/553) +* `FIX` [#562](https://github.com/LuaLS/lua-language-server/issues/562) +* `FIX` [#563](https://github.com/LuaLS/lua-language-server/issues/563) ## 1.21.3 `2021-6-17` @@ -1222,14 +1325,14 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. ## 1.21.2 `2021-5-18` * `FIX` loaded new file with ignored filename -* `FIX` [#536](https://github.com/sumneko/lua-language-server/issues/536) -* `FIX` [#537](https://github.com/sumneko/lua-language-server/issues/537) -* `FIX` [#538](https://github.com/sumneko/lua-language-server/issues/538) -* `FIX` [#539](https://github.com/sumneko/lua-language-server/issues/539) +* `FIX` [#536](https://github.com/LuaLS/lua-language-server/issues/536) +* `FIX` [#537](https://github.com/LuaLS/lua-language-server/issues/537) +* `FIX` [#538](https://github.com/LuaLS/lua-language-server/issues/538) +* `FIX` [#539](https://github.com/LuaLS/lua-language-server/issues/539) ## 1.21.1 `2021-5-8` -* `FIX` [#529](https://github.com/sumneko/lua-language-server/issues/529) +* `FIX` [#529](https://github.com/LuaLS/lua-language-server/issues/529) ## 1.21.0 `2021-5-7` @@ -1243,47 +1346,47 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. * `NEW` setting: `hover.enumsLimit` * `CHG` folding: supports `-- #region` * `FIX` completion: details may be suspended -* `FIX` [#522](https://github.com/sumneko/lua-language-server/issues/522) -* `FIX` [#523](https://github.com/sumneko/lua-language-server/issues/523) +* `FIX` [#522](https://github.com/LuaLS/lua-language-server/issues/522) +* `FIX` [#523](https://github.com/LuaLS/lua-language-server/issues/523) ## 1.20.4 `2021-4-13` * `NEW` diagnostic: `deprecated` -* `FIX` [#464](https://github.com/sumneko/lua-language-server/issues/464) -* `FIX` [#497](https://github.com/sumneko/lua-language-server/issues/497) -* `FIX` [#502](https://github.com/sumneko/lua-language-server/issues/502) +* `FIX` [#464](https://github.com/LuaLS/lua-language-server/issues/464) +* `FIX` [#497](https://github.com/LuaLS/lua-language-server/issues/497) +* `FIX` [#502](https://github.com/LuaLS/lua-language-server/issues/502) ## 1.20.3 `2021-4-6` -* `FIX` [#479](https://github.com/sumneko/lua-language-server/issues/479) -* `FIX` [#483](https://github.com/sumneko/lua-language-server/issues/483) -* `FIX` [#485](https://github.com/sumneko/lua-language-server/issues/485) -* `FIX` [#487](https://github.com/sumneko/lua-language-server/issues/487) -* `FIX` [#488](https://github.com/sumneko/lua-language-server/issues/488) -* `FIX` [#490](https://github.com/sumneko/lua-language-server/issues/490) -* `FIX` [#495](https://github.com/sumneko/lua-language-server/issues/495) +* `FIX` [#479](https://github.com/LuaLS/lua-language-server/issues/479) +* `FIX` [#483](https://github.com/LuaLS/lua-language-server/issues/483) +* `FIX` [#485](https://github.com/LuaLS/lua-language-server/issues/485) +* `FIX` [#487](https://github.com/LuaLS/lua-language-server/issues/487) +* `FIX` [#488](https://github.com/LuaLS/lua-language-server/issues/488) +* `FIX` [#490](https://github.com/LuaLS/lua-language-server/issues/490) +* `FIX` [#495](https://github.com/LuaLS/lua-language-server/issues/495) ## 1.20.2 `2021-4-2` * `CHG` `LuaDoc`: supports `---@param self TYPE` * `CHG` completion: does not show suggests after `\n`, `{` and `,`, unless your setting `editor.acceptSuggestionOnEnter` is `off` -* `FIX` [#482](https://github.com/sumneko/lua-language-server/issues/482) +* `FIX` [#482](https://github.com/LuaLS/lua-language-server/issues/482) ## 1.20.1 `2021-3-27` * `FIX` telemetry window blocks initializing -* `FIX` [#468](https://github.com/sumneko/lua-language-server/issues/468) +* `FIX` [#468](https://github.com/LuaLS/lua-language-server/issues/468) ## 1.20.0 `2021-3-27` -* `CHG` telemetry: change to opt-in, see [#462](https://github.com/sumneko/lua-language-server/issues/462) and [Privacy-Policy](https://github.com/sumneko/lua-language-server/wiki/Privacy-Policy) -* `FIX` [#467](https://github.com/sumneko/lua-language-server/issues/467) +* `CHG` telemetry: change to opt-in, see [#462](https://github.com/LuaLS/lua-language-server/issues/462) and [Privacy-Policy](https://github.com/LuaLS/lua-language-server/wiki/Privacy-Policy) +* `FIX` [#467](https://github.com/LuaLS/lua-language-server/issues/467) ## 1.19.1 `2021-3-22` * `CHG` improve performance -* `FIX` [#457](https://github.com/sumneko/lua-language-server/issues/457) -* `FIX` [#458](https://github.com/sumneko/lua-language-server/issues/458) +* `FIX` [#457](https://github.com/LuaLS/lua-language-server/issues/457) +* `FIX` [#458](https://github.com/LuaLS/lua-language-server/issues/458) ## 1.19.0 `2021-3-18` @@ -1330,13 +1433,13 @@ f( -- view comments of `1` and `2` in completion * `CHG` improve initialization speed * `CHG` improve performance * `FIX` missed syntax error `function m['x']() end` -* `FIX` [#452](https://github.com/sumneko/lua-language-server/issues/452) +* `FIX` [#452](https://github.com/LuaLS/lua-language-server/issues/452) ## 1.18.1 `2021-3-10` * `CHG` semantic-tokens: improve colors of `const` and `close` * `CHG` type-formating: improve execution conditions -* `FIX` [#444](https://github.com/sumneko/lua-language-server/issues/444) +* `FIX` [#444](https://github.com/LuaLS/lua-language-server/issues/444) ## 1.18.0 `2021-3-9` @@ -1363,21 +1466,21 @@ f( -- view comments of `1` and `2` in completion * `CHG` `Lua.workspace.library`: use `path[]` instead of `<path, true>` * `FIX` missed syntax error `local a <const>= 1` * `FIX` workspace: preload blocked when hitting `Lua.workspace.maxPreload` -* `FIX` [#443](https://github.com/sumneko/lua-language-server/issues/443) -* `FIX` [#445](https://github.com/sumneko/lua-language-server/issues/445) +* `FIX` [#443](https://github.com/LuaLS/lua-language-server/issues/443) +* `FIX` [#445](https://github.com/LuaLS/lua-language-server/issues/445) ## 1.17.4 `2021-3-4` -* `FIX` [#437](https://github.com/sumneko/lua-language-server/issues/437) again -* `FIX` [#438](https://github.com/sumneko/lua-language-server/issues/438) +* `FIX` [#437](https://github.com/LuaLS/lua-language-server/issues/437) again +* `FIX` [#438](https://github.com/LuaLS/lua-language-server/issues/438) ## 1.17.3 `2021-3-3` * `CHG` intelli-scense: treat `V[]` as `table<integer, V>` in `pairs` * `FIX` completion: `detail` disappears during continuous input -* `FIX` [#435](https://github.com/sumneko/lua-language-server/issues/435) -* `FIX` [#436](https://github.com/sumneko/lua-language-server/issues/436) -* `FIX` [#437](https://github.com/sumneko/lua-language-server/issues/437) +* `FIX` [#435](https://github.com/LuaLS/lua-language-server/issues/435) +* `FIX` [#436](https://github.com/LuaLS/lua-language-server/issues/436) +* `FIX` [#437](https://github.com/LuaLS/lua-language-server/issues/437) ## 1.17.2 `2021-3-2` @@ -1388,9 +1491,9 @@ f( -- view comments of `1` and `2` in completion * `CHG` intelli-scense: improve infer across `table<K, V>` and `V[]`. * `CHG` intelli-scense: improve infer across `pairs` and `ipairs` * `FIX` hover: shows nothing when hovering unknown function -* `FIX` [#398](https://github.com/sumneko/lua-language-server/issues/398) -* `FIX` [#421](https://github.com/sumneko/lua-language-server/issues/421) -* `FIX` [#422](https://github.com/sumneko/lua-language-server/issues/422) +* `FIX` [#398](https://github.com/LuaLS/lua-language-server/issues/398) +* `FIX` [#421](https://github.com/LuaLS/lua-language-server/issues/421) +* `FIX` [#422](https://github.com/LuaLS/lua-language-server/issues/422) ## 1.17.0 `2021-2-24` @@ -1399,69 +1502,69 @@ f( -- view comments of `1` and `2` in completion * `CHG` completion: improve field and table * `CHG` improve infer cross `ipairs` * `CHG` cache globals when loading -* `CHG` completion: remove trigger character `\n` for now, see [#401](https://github.com/sumneko/lua-language-server/issues/401) +* `CHG` completion: remove trigger character `\n` for now, see [#401](https://github.com/LuaLS/lua-language-server/issues/401) * `FIX` diagnositc: may open file with wrong uri case -* `FIX` [#406](https://github.com/sumneko/lua-language-server/issues/406) +* `FIX` [#406](https://github.com/LuaLS/lua-language-server/issues/406) ## 1.16.1 `2021-2-22` * `FIX` signature: parameters may be misplaced * `FIX` completion: interface in nested table * `FIX` completion: interface not show after `,` -* `FIX` [#400](https://github.com/sumneko/lua-language-server/issues/400) -* `FIX` [#402](https://github.com/sumneko/lua-language-server/issues/402) -* `FIX` [#403](https://github.com/sumneko/lua-language-server/issues/403) -* `FIX` [#404](https://github.com/sumneko/lua-language-server/issues/404) +* `FIX` [#400](https://github.com/LuaLS/lua-language-server/issues/400) +* `FIX` [#402](https://github.com/LuaLS/lua-language-server/issues/402) +* `FIX` [#403](https://github.com/LuaLS/lua-language-server/issues/403) +* `FIX` [#404](https://github.com/LuaLS/lua-language-server/issues/404) * `FIX` runtime errors ## 1.16.0 `2021-2-20` * `NEW` file encoding supports `ansi` -* `NEW` completion: supports interface, see [#384](https://github.com/sumneko/lua-language-server/issues/384) +* `NEW` completion: supports interface, see [#384](https://github.com/LuaLS/lua-language-server/issues/384) * `NEW` `LuaDoc`: supports multiple class inheritance: `---@class Food: Burger, Pizza, Pie, Pasta` * `CHG` rename `table*` to `tablelib` -* `CHG` `LuaDoc`: revert compatible with `--@`, see [#392](https://github.com/sumneko/lua-language-server/issues/392) +* `CHG` `LuaDoc`: revert compatible with `--@`, see [#392](https://github.com/LuaLS/lua-language-server/issues/392) * `CHG` improve performance * `FIX` missed syntax error `f() = 1` * `FIX` missed global `bit` in `LuaJIT` * `FIX` completion: may insert error text when continuous inputing * `FIX` completion: may insert error text after resolve -* `FIX` [#349](https://github.com/sumneko/lua-language-server/issues/349) -* `FIX` [#396](https://github.com/sumneko/lua-language-server/issues/396) +* `FIX` [#349](https://github.com/LuaLS/lua-language-server/issues/349) +* `FIX` [#396](https://github.com/LuaLS/lua-language-server/issues/396) ## 1.15.1 `2021-2-18` * `CHG` diagnostic: `unused-local` excludes `doc.param` -* `CHG` definition: excludes values, see [#391](https://github.com/sumneko/lua-language-server/issues/391) +* `CHG` definition: excludes values, see [#391](https://github.com/LuaLS/lua-language-server/issues/391) * `FIX` not works on Linux and macOS ## 1.15.0 `2021-2-9` * `NEW` LUNAR YEAR, BE HAPPY! * `CHG` diagnostic: when there are too many errors, the main errors will be displayed first -* `CHG` main thread no longer loop sleeps, see [#329](https://github.com/sumneko/lua-language-server/issues/329) [#386](https://github.com/sumneko/lua-language-server/issues/386) +* `CHG` main thread no longer loop sleeps, see [#329](https://github.com/LuaLS/lua-language-server/issues/329) [#386](https://github.com/LuaLS/lua-language-server/issues/386) * `CHG` improve performance ## 1.14.3 `2021-2-8` -* `CHG` hint: disabled by default, see [#380](https://github.com/sumneko/lua-language-server/issues/380) -* `FIX` [#381](https://github.com/sumneko/lua-language-server/issues/381) -* `FIX` [#382](https://github.com/sumneko/lua-language-server/issues/382) -* `FIX` [#388](https://github.com/sumneko/lua-language-server/issues/388) +* `CHG` hint: disabled by default, see [#380](https://github.com/LuaLS/lua-language-server/issues/380) +* `FIX` [#381](https://github.com/LuaLS/lua-language-server/issues/381) +* `FIX` [#382](https://github.com/LuaLS/lua-language-server/issues/382) +* `FIX` [#388](https://github.com/LuaLS/lua-language-server/issues/388) ## 1.14.2 `2021-2-4` -* `FIX` [#356](https://github.com/sumneko/lua-language-server/issues/356) -* `FIX` [#375](https://github.com/sumneko/lua-language-server/issues/375) -* `FIX` [#376](https://github.com/sumneko/lua-language-server/issues/376) -* `FIX` [#377](https://github.com/sumneko/lua-language-server/issues/377) -* `FIX` [#378](https://github.com/sumneko/lua-language-server/issues/378) -* `FIX` [#379](https://github.com/sumneko/lua-language-server/issues/379) +* `FIX` [#356](https://github.com/LuaLS/lua-language-server/issues/356) +* `FIX` [#375](https://github.com/LuaLS/lua-language-server/issues/375) +* `FIX` [#376](https://github.com/LuaLS/lua-language-server/issues/376) +* `FIX` [#377](https://github.com/LuaLS/lua-language-server/issues/377) +* `FIX` [#378](https://github.com/LuaLS/lua-language-server/issues/378) +* `FIX` [#379](https://github.com/LuaLS/lua-language-server/issues/379) * `FIX` a lot of runtime errors ## 1.14.1 `2021-2-2` -* `FIX` [#372](https://github.com/sumneko/lua-language-server/issues/372) +* `FIX` [#372](https://github.com/LuaLS/lua-language-server/issues/372) ## 1.14.0 `2021-2-2` @@ -1471,8 +1574,8 @@ f( -- view comments of `1` and `2` in completion * `CHG` create/delete/rename files no longer reload workspace * `CHG` `LuaDoc`: compatible with `--@` * `FIX` `VSCode` settings -* `FIX` [#368](https://github.com/sumneko/lua-language-server/issues/368) -* `FIX` [#371](https://github.com/sumneko/lua-language-server/issues/371) +* `FIX` [#368](https://github.com/LuaLS/lua-language-server/issues/368) +* `FIX` [#371](https://github.com/LuaLS/lua-language-server/issues/371) ## 1.13.0 `2021-1-28` @@ -1494,15 +1597,15 @@ f( -- view comments of `1` and `2` in completion ## 1.12.0 `2021-1-26` * `NEW` progress -* `NEW` [#340](https://github.com/sumneko/lua-language-server/pull/340): supports `---@type table<string, number>` -* `FIX` [#355](https://github.com/sumneko/lua-language-server/pull/355) -* `FIX` [#359](https://github.com/sumneko/lua-language-server/issues/359) -* `FIX` [#361](https://github.com/sumneko/lua-language-server/issues/361) +* `NEW` [#340](https://github.com/LuaLS/lua-language-server/pull/340): supports `---@type table<string, number>` +* `FIX` [#355](https://github.com/LuaLS/lua-language-server/pull/355) +* `FIX` [#359](https://github.com/LuaLS/lua-language-server/issues/359) +* `FIX` [#361](https://github.com/LuaLS/lua-language-server/issues/361) ## 1.11.2 `2021-1-7` -* `FIX` [#345](https://github.com/sumneko/lua-language-server/issues/345): not works with unexpect args -* `FIX` [#346](https://github.com/sumneko/lua-language-server/issues/346): dont modify the cache +* `FIX` [#345](https://github.com/LuaLS/lua-language-server/issues/345): not works with unexpect args +* `FIX` [#346](https://github.com/LuaLS/lua-language-server/issues/346): dont modify the cache ## 1.11.1 `2021-1-5` @@ -1527,7 +1630,7 @@ f( -- view comments of `1` and `2` in completion * `CHG` completion: show words in string * `CHG` completion: split `for .. in` to `for .. ipairs` and `for ..pairs` * `CHG` diagnostic: `unused-function` checks recursive -* `FIX` [#339](https://github.com/sumneko/lua-language-server/issues/339) +* `FIX` [#339](https://github.com/LuaLS/lua-language-server/issues/339) ## 1.9.0 `2020-12-31` @@ -1551,7 +1654,7 @@ f( -- view comments of `1` and `2` in completion `2020-12-23` * `NEW` runtime: support nonstandard symbol * `NEW` diagnostic: `close-non-object` -* `FIX` [#318](https://github.com/sumneko/lua-language-server/issues/318) +* `FIX` [#318](https://github.com/LuaLS/lua-language-server/issues/318) ## 1.7.4 `2020-12-20` @@ -1560,12 +1663,12 @@ f( -- view comments of `1` and `2` in completion ## 1.7.3 `2020-12-20` * `FIX` luadoc: typo of `package.config` -* `FIX` [#310](https://github.com/sumneko/lua-language-server/issues/310) +* `FIX` [#310](https://github.com/LuaLS/lua-language-server/issues/310) ## 1.7.2 `2020-12-17` * `CHG` completion: use custom tabsize -* `FIX` [#307](https://github.com/sumneko/lua-language-server/issues/307) +* `FIX` [#307](https://github.com/LuaLS/lua-language-server/issues/307) * `FIX` a lot of runtime errors ## 1.7.1 @@ -1579,16 +1682,16 @@ f( -- view comments of `1` and `2` in completion `2020-12-16` * `NEW` diagnostic: `undefined-field` * `NEW` telemetry: - + [What data will be sent](https://github.com/sumneko/lua-language-server/blob/master/script/service/telemetry.lua) - + [How to use this data](https://github.com/sumneko/lua-telemetry-server/tree/master/method) + + [What data will be sent](https://github.com/LuaLS/lua-language-server/blob/master/script/service/telemetry.lua) + + [How to use this data](https://github.com/LuaLS/lua-telemetry-server/tree/master/method) * `CHG` diagnostic: `unused-function` ignores function with `<close>` * `CHG` semantic: not cover local call * `CHG` language client: update to [7.0.0](https://github.com/microsoft/vscode-languageserver-node/commit/20681d7632bb129def0c751be73cf76bd01f2f3a) * `FIX` semantic: tokens may not be updated correctly * `FIX` completion: require path broken * `FIX` hover: document uri -* `FIX` [#291](https://github.com/sumneko/lua-language-server/issues/291) -* `FIX` [#294](https://github.com/sumneko/lua-language-server/issues/294) +* `FIX` [#291](https://github.com/LuaLS/lua-language-server/issues/291) +* `FIX` [#294](https://github.com/LuaLS/lua-language-server/issues/294) ## 1.6.0 `2020-12-14` @@ -1600,16 +1703,16 @@ f( -- view comments of `1` and `2` in completion * `CHG` hover: `LuaDoc` also catchs `--` (no need `---`) * `CHG` rename: support doc * `CHG` completion: keyword considers expression -* `FIX` [#297](https://github.com/sumneko/lua-language-server/issues/297) +* `FIX` [#297](https://github.com/LuaLS/lua-language-server/issues/297) ## 1.5.0 `2020-12-5` * `NEW` setting `runtime.unicodeName` * `NEW` fully supports `---@generic T` -* `FIX` [#274](https://github.com/sumneko/lua-language-server/issues/274) -* `FIX` [#276](https://github.com/sumneko/lua-language-server/issues/276) -* `FIX` [#279](https://github.com/sumneko/lua-language-server/issues/279) -* `FIX` [#280](https://github.com/sumneko/lua-language-server/issues/280) +* `FIX` [#274](https://github.com/LuaLS/lua-language-server/issues/274) +* `FIX` [#276](https://github.com/LuaLS/lua-language-server/issues/276) +* `FIX` [#279](https://github.com/LuaLS/lua-language-server/issues/279) +* `FIX` [#280](https://github.com/LuaLS/lua-language-server/issues/280) ## 1.4.0 `2020-12-3` @@ -1635,12 +1738,12 @@ f( -- view comments of `1` and `2` in completion ## 1.2.1 `2020-11-27` -* `FIX` syntaxes tokens: [#272](https://github.com/sumneko/lua-language-server/issues/272) +* `FIX` syntaxes tokens: [#272](https://github.com/LuaLS/lua-language-server/issues/272) ## 1.2.0 `2020-11-27` -* `NEW` hover shows comments from `---@param` and `---@return`: [#135](https://github.com/sumneko/lua-language-server/issues/135) +* `NEW` hover shows comments from `---@param` and `---@return`: [#135](https://github.com/LuaLS/lua-language-server/issues/135) * `NEW` support `LuaDoc` as tail comment * `FIX` `---@class` inheritance * `FIX` missed syntaxes token: `punctuation.definition.parameters.finish.lua` @@ -1648,12 +1751,12 @@ f( -- view comments of `1` and `2` in completion ## 1.1.4 `2020-11-25` -* `FIX` wiered completion suggests for require paths in `Linux` and `macOS`: [#269](https://github.com/sumneko/lua-language-server/issues/269) +* `FIX` wiered completion suggests for require paths in `Linux` and `macOS`: [#269](https://github.com/LuaLS/lua-language-server/issues/269) ## 1.1.3 `2020-11-25` -* `FIX` extension not works in `Ubuntu`: [#268](https://github.com/sumneko/lua-language-server/issues/268) +* `FIX` extension not works in `Ubuntu`: [#268](https://github.com/LuaLS/lua-language-server/issues/268) ## 1.1.2 `2020-11-24` @@ -1664,7 +1767,7 @@ f( -- view comments of `1` and `2` in completion * `CHG` `LuaDoc` supports `--- @` * `CHG` `find reference` uses extra `Lua.intelliSense.searchDepth` * `CHG` diagnostics are limited by `100` in each file -* `FIX` library files are under limit of `Lua.workspace.maxPreload`: [#266](https://github.com/sumneko/lua-language-server/issues/266) +* `FIX` library files are under limit of `Lua.workspace.maxPreload`: [#266](https://github.com/LuaLS/lua-language-server/issues/266) ## 1.1.1 `2020-11-23` @@ -1689,9 +1792,9 @@ f( -- view comments of `1` and `2` in completion * `CHG` optimize performance * `CHG` updated language client * `CHG` `unused-function` ignores global functions (may used out of Lua) -* `CHG` checks if client supports `Lua.completion.enable`: [#259](https://github.com/sumneko/lua-language-server/issues/259) +* `CHG` checks if client supports `Lua.completion.enable`: [#259](https://github.com/LuaLS/lua-language-server/issues/259) * `FIX` support for single Lua file -* `FIX` [#257](https://github.com/sumneko/lua-language-server/issues/257) +* `FIX` [#257](https://github.com/LuaLS/lua-language-server/issues/257) ## 1.0.5 `2020-11-14` @@ -1708,7 +1811,7 @@ f( -- view comments of `1` and `2` in completion * `NEW` server kills itself when disconnecting * `NEW` `LuaDoc` supports more `EmmyLua` -* `FIX` `Lua.diagnostics.enable` not works: [#251](https://github.com/sumneko/lua-language-server/issues/251) +* `FIX` `Lua.diagnostics.enable` not works: [#251](https://github.com/LuaLS/lua-language-server/issues/251) ## 1.0.2 `2020-11-11` @@ -1716,7 +1819,7 @@ f( -- view comments of `1` and `2` in completion * `NEW` supports `---|` after `doc.type` * `CHG` `lowcase-global` ignores globals with `---@class` * `FIX` endless loop -* `FIX` [#244](https://github.com/sumneko/lua-language-server/issues/244) +* `FIX` [#244](https://github.com/LuaLS/lua-language-server/issues/244) ## 1.0.1 `2020-11-10` diff --git a/doc/en-us/config.md b/doc/en-us/config.md index b20e8bce..2d519824 100644 --- a/doc/en-us/config.md +++ b/doc/en-us/config.md @@ -288,6 +288,7 @@ Array<string> * ``"missing-return-value"`` * ``"need-check-nil"`` * ``"need-paren"`` +* ``"nesting-long-mark"`` * ``"newfield-call"`` * ``"newline-call"`` * ``"no-unknown"`` @@ -1577,7 +1578,7 @@ string # misc.parameters -[Command line parameters](https://github.com/sumneko/lua-telemetry-server/tree/master/method) when starting the language server in VSCode. +[Command line parameters](https://github.com/LuaLS/lua-telemetry-server/tree/master/method) when starting the language server in VSCode. ## type @@ -1752,7 +1753,7 @@ false # runtime.plugin -Plugin path. Please read [wiki](https://github.com/sumneko/lua-language-server/wiki/Plugins) to learn more. +Plugin path. Please read [wiki](https://github.com/LuaLS/lua-language-server/wiki/Plugins) to learn more. ## type @@ -2160,22 +2161,6 @@ integer 500 ``` -# workspace.supportScheme - -Provide language server for the Lua files of the following scheme. - -## type - -```ts -Array<string> -``` - -## default - -```jsonc -["file","untitled","git"] -``` - # workspace.useGitIgnore Ignore files list in `.gitignore` . @@ -2194,7 +2179,7 @@ true # workspace.userThirdParty -Add private third-party library configuration file paths here, please refer to the built-in [configuration file path](https://github.com/sumneko/lua-language-server/tree/master/meta/3rd) +Add private third-party library configuration file paths here, please refer to the built-in [configuration file path](https://github.com/LuaLS/lua-language-server/tree/master/meta/3rd) ## type diff --git a/doc/pt-br/config.md b/doc/pt-br/config.md index 5365f204..24cf8d3b 100644 --- a/doc/pt-br/config.md +++ b/doc/pt-br/config.md @@ -288,6 +288,7 @@ Array<string> * ``"missing-return-value"`` * ``"need-check-nil"`` * ``"need-paren"`` +* ``"nesting-long-mark"`` * ``"newfield-call"`` * ``"newline-call"`` * ``"no-unknown"`` @@ -1577,7 +1578,7 @@ string # misc.parameters -[Command line parameters](https://github.com/sumneko/lua-telemetry-server/tree/master/method) when starting the language service in VSCode. +[Command line parameters](https://github.com/LuaLS/lua-telemetry-server/tree/master/method) when starting the language service in VSCode. ## type @@ -1752,7 +1753,7 @@ false # runtime.plugin -Plugin path. Please read [wiki](https://github.com/sumneko/lua-language-server/wiki/Plugins) to learn more. +Plugin path. Please read [wiki](https://github.com/LuaLS/lua-language-server/wiki/Plugins) to learn more. ## type @@ -2160,22 +2161,6 @@ integer 500 ``` -# workspace.supportScheme - -Provide language server for the Lua files of the following scheme. - -## type - -```ts -Array<string> -``` - -## default - -```jsonc -["file","untitled","git"] -``` - # workspace.useGitIgnore Ignore files list in `.gitignore` . @@ -2194,7 +2179,7 @@ true # workspace.userThirdParty -Add private third-party library configuration file paths here, please refer to the built-in [configuration file path](https://github.com/sumneko/lua-language-server/tree/master/meta/3rd) +Add private third-party library configuration file paths here, please refer to the built-in [configuration file path](https://github.com/LuaLS/lua-language-server/tree/master/meta/3rd) ## type diff --git a/doc/zh-cn/config.md b/doc/zh-cn/config.md index 1516f4b0..991932b6 100644 --- a/doc/zh-cn/config.md +++ b/doc/zh-cn/config.md @@ -288,6 +288,7 @@ Array<string> * ``"missing-return-value"`` * ``"need-check-nil"`` * ``"need-paren"`` +* ``"nesting-long-mark"`` * ``"newfield-call"`` * ``"newline-call"`` * ``"no-unknown"`` @@ -1576,7 +1577,7 @@ string # misc.parameters -VSCode中启动语言服务时的[命令行参数](https://github.com/sumneko/lua-language-server/wiki/Getting-Started#arguments)。 +VSCode中启动语言服务时的[命令行参数](https://github.com/LuaLS/lua-language-server/wiki/Getting-Started#arguments)。 ## type @@ -1751,7 +1752,7 @@ false # runtime.plugin -插件路径,请查阅[文档](https://github.com/sumneko/lua-language-server/wiki/Plugins)了解用法。 +插件路径,请查阅[文档](https://github.com/LuaLS/lua-language-server/wiki/Plugins)了解用法。 ## type @@ -2159,22 +2160,6 @@ integer 500 ``` -# workspace.supportScheme - -为以下 scheme 的lua文件提供语言服务。 - -## type - -```ts -Array<string> -``` - -## default - -```jsonc -["file","untitled","git"] -``` - # workspace.useGitIgnore 忽略 `.gitignore` 中列举的文件。 @@ -2193,7 +2178,7 @@ true # workspace.userThirdParty -在这里添加私有的第三方库适配文件路径,请参考内置的[配置文件路径](https://github.com/sumneko/lua-language-server/tree/master/meta/3rd) +在这里添加私有的第三方库适配文件路径,请参考内置的[配置文件路径](https://github.com/LuaLS/lua-language-server/tree/master/meta/3rd) ## type diff --git a/doc/zh-tw/config.md b/doc/zh-tw/config.md index ea550ed1..83cef315 100644 --- a/doc/zh-tw/config.md +++ b/doc/zh-tw/config.md @@ -288,6 +288,7 @@ Array<string> * ``"missing-return-value"`` * ``"need-check-nil"`` * ``"need-paren"`` +* ``"nesting-long-mark"`` * ``"newfield-call"`` * ``"newline-call"`` * ``"no-unknown"`` @@ -1576,7 +1577,7 @@ string # misc.parameters -VSCode中啟動語言伺服時的[命令列參數](https://github.com/sumneko/lua-language-server/wiki/Getting-Started#arguments)。 +VSCode中啟動語言伺服時的[命令列參數](https://github.com/LuaLS/lua-language-server/wiki/Getting-Started#arguments)。 ## type @@ -1751,7 +1752,7 @@ false # runtime.plugin -延伸模組路徑,請查閱[文件](https://github.com/sumneko/lua-language-server/wiki/Plugins)瞭解用法。 +延伸模組路徑,請查閱[文件](https://github.com/LuaLS/lua-language-server/wiki/Plugins)瞭解用法。 ## type @@ -2159,22 +2160,6 @@ integer 500 ``` -# workspace.supportScheme - -為以下 `scheme` 的lua檔案提供語言伺服。 - -## type - -```ts -Array<string> -``` - -## default - -```jsonc -["file","untitled","git"] -``` - # workspace.useGitIgnore 忽略 `.gitignore` 中列舉的檔案。 @@ -2193,7 +2178,7 @@ true # workspace.userThirdParty -在這裡添加私有的第三方庫適應檔案路徑,請參考內建的[組態檔案路徑](https://github.com/sumneko/lua-language-server/tree/master/meta/3rd) +在這裡添加私有的第三方庫適應檔案路徑,請參考內建的[組態檔案路徑](https://github.com/LuaLS/lua-language-server/tree/master/meta/3rd) ## type diff --git a/locale/en-us/script.lua b/locale/en-us/script.lua index 9910aa90..4b74fa51 100644 --- a/locale/en-us/script.lua +++ b/locale/en-us/script.lua @@ -177,7 +177,7 @@ WORKSPACE_DIAGNOSTIC = WORKSPACE_SKIP_HUGE_FILE = 'For performance reasons, the parsing of this file has been stopped: {}' WORKSPACE_NOT_ALLOWED = -'Your workspace is set to `{}`. Lua language server refused to load this directory. Please check your configuration.[learn more here](https://github.com/sumneko/lua-language-server/wiki/FAQ#why-is-the-server-scanning-the-wrong-folder)' +'Your workspace is set to `{}`. Lua language server refused to load this directory. Please check your configuration.[learn more here](https://github.com/LuaLS/lua-language-server/wiki/FAQ#why-is-the-server-scanning-the-wrong-folder)' WORKSPACE_SCAN_TOO_MUCH = 'More than {} files have been scanned. The current scanned directory is `{}`. Please confirm whether the configuration is correct.' @@ -281,6 +281,8 @@ PARSER_NEED_PAREN = -- TODO: need translate! 'Need to add a pair of parentheses.' PARSER_NESTING_LONG_MARK = 'Nesting of `[[...]]` is not allowed in Lua 5.1 .' +PARSER_LOCAL_LIMIT = +'Only 200 active local variables and upvalues can be existed at the same time.' PARSER_LUADOC_MISS_CLASS_NAME = '<class name> expected.' PARSER_LUADOC_MISS_EXTENDS_SYMBOL = @@ -528,7 +530,7 @@ WINDOW_APPLY_SETTING = WINDOW_CHECK_SEMANTIC = 'If you are using the color theme in the market, you may need to modify `editor.semanticHighlighting.enabled` to `true` to make semantic tokens take effect.' WINDOW_TELEMETRY_HINT = -'Please allow sending anonymous usage data and error reports to help us further improve this extension. Read our privacy policy [here](https://github.com/sumneko/lua-language-server/wiki/Home#privacy) .' +'Please allow sending anonymous usage data and error reports to help us further improve this extension. Read our privacy policy [here](https://github.com/LuaLS/lua-language-server/wiki/Home#privacy) .' WINDOW_TELEMETRY_ENABLE = 'Allow' WINDOW_TELEMETRY_DISABLE = @@ -568,6 +570,22 @@ CONFIG_TYPE_ERROR = 'The setting file must be in lua or json format: {}' CONFIG_MODIFY_FAIL_SYNTAX_ERROR = 'Failed to modify settings, there are syntax errors in the settings file: {}' +CONFIG_MODIFY_FAIL_NO_WORKSPACE = +[[ +Failed to modify settings: +* The current mode is single-file mode, server cannot create `.luarc.json` without workspace. +* The language client dose not support modifying settings from the server side. + +Please modify following settings manually: +{} +]] +CONFIG_MODIFY_FAIL = +[[ +Failed to modify settings + +Please modify following settings manually: +{} +]] PLUGIN_RUNTIME_ERROR = [[ @@ -602,6 +620,14 @@ CLI_CHECK_SUCCESS = 'Diagnosis completed, no problems found' CLI_CHECK_RESULTS = 'Diagnosis complete, {} problems found, see {}' +CLI_DOC_INITING = +'Loading documents ...' +CLI_DOC_DONE = +[[ +Document exporting completed! +Raw data: {} +Markdown(example): {} +]] TYPE_ERROR_ENUM_GLOBAL_DISMATCH = 'Type `{child}` cannot match enumeration type of `{parent}`' @@ -649,7 +675,7 @@ Defines a class/table structure Manager = {} ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#class) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#class) ]=] LUADOC_DESC_TYPE = [=[ @@ -700,7 +726,7 @@ local x --x[""] is true local myFunction ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#types-and-type) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#types-and-type) ]=] LUADOC_DESC_ALIAS = [=[ @@ -750,7 +776,7 @@ local enums = { ---| `enums.CLOSE` ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#alias) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#alias) ]=] LUADOC_DESC_PARAM = [=[ @@ -775,7 +801,7 @@ function get(url, headers, timeout) end function concat(base, ...) end ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#param) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#param) ]=] LUADOC_DESC_RETURN = [=[ @@ -813,7 +839,7 @@ function getFirstLast() end function getTags(item) end ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#return) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#return) ]=] LUADOC_DESC_FIELD = [=[ @@ -844,7 +870,7 @@ response = get("localhost") statusCode = response.status.code ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#field) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#field) ]=] LUADOC_DESC_GENERIC = [=[ @@ -901,7 +927,7 @@ local v = Generic("Foo") -- v is an object of Foo -- we give for key (K) or value (V) ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#generics-and-generic) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#generics-and-generic) ]=] LUADOC_DESC_VARARG = [=[ @@ -920,7 +946,7 @@ provide typing or allow descriptions. function concat(...) end ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#vararg) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#vararg) ]=] LUADOC_DESC_OVERLOAD = [=[ @@ -935,7 +961,7 @@ Allows defining of multiple function signatures. function table.insert(t, position, value) end ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#overload) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#overload) ]=] LUADOC_DESC_DEPRECATED = [=[ @@ -946,7 +972,7 @@ being ~~struck through~~. `---@deprecated` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#deprecated) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#deprecated) ]=] LUADOC_DESC_META = [=[ @@ -961,7 +987,7 @@ There are 3 main distinctions to note with meta files: `---@meta` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#meta) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#meta) ]=] LUADOC_DESC_VERSION = [=[ @@ -986,7 +1012,7 @@ function onlyWorksInJIT() end function oldLuaOnly() end ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#version) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#version) ]=] LUADOC_DESC_SEE = [=[ @@ -996,7 +1022,7 @@ Define something that can be viewed for more information `---@see <text>` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#see) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#see) ]=] LUADOC_DESC_DIAGNOSTIC = [=[ @@ -1004,7 +1030,7 @@ Enable/disable diagnostics for error/warnings/etc. Actions: `disable`, `enable`, `disable-line`, `disable-next-line` -[Names](https://github.com/sumneko/lua-language-server/blob/cbb6e6224094c4eb874ea192c5f85a6cba099588/script/proto/define.lua#L54) +[Names](https://github.com/LuaLS/lua-language-server/blob/cbb6e6224094c4eb874ea192c5f85a6cba099588/script/proto/define.lua#L54) ## Syntax `---@diagnostic <action>[: <name>]` @@ -1022,7 +1048,7 @@ local unused = "hello world" ---@diagnostic enable: unused-local ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#diagnostic) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#diagnostic) ]=] LUADOC_DESC_MODULE = [=[ @@ -1039,7 +1065,7 @@ local stringUtils local module = require('string.utils') ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#module) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#module) ]=] LUADOC_DESC_ASYNC = [=[ @@ -1049,7 +1075,7 @@ Marks a function as asynchronous. `---@async` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#async) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#async) ]=] LUADOC_DESC_NODISCARD = [=[ @@ -1061,7 +1087,7 @@ be ignored. `---@nodiscard` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#nodiscard) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#nodiscard) ]=] LUADOC_DESC_CAST = [=[ @@ -1096,7 +1122,7 @@ local x --> string|table print(x) --> table ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#cast) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#cast) ]=] LUADOC_DESC_OPERATOR = [=[ @@ -1126,12 +1152,12 @@ pA = Passcode.new(1234) pB = -pA --> integer ``` -[View Request](https://github.com/sumneko/lua-language-server/issues/599) +[View Request](https://github.com/LuaLS/lua-language-server/issues/599) ]=] LUADOC_DESC_ENUM = [=[ Mark a table as an enum. If you want an enum but can't define it as a Lua -table, take a look at the [`@alias`](https://github.com/sumneko/lua-language-server/wiki/Annotations#alias) +table, take a look at the [`@alias`](https://github.com/LuaLS/lua-language-server/wiki/Annotations#alias) tag. ## Syntax diff --git a/locale/en-us/setting.lua b/locale/en-us/setting.lua index c1681e98..18840e94 100644 --- a/locale/en-us/setting.lua +++ b/locale/en-us/setting.lua @@ -1,5 +1,7 @@ ---@diagnostic disable: undefined-global +config.addonManager.enable = +"Whether the addon manager is enabled or not." config.runtime.version = "Lua runtime version." config.runtime.path = @@ -25,7 +27,7 @@ config.runtime.unicodeName = config.runtime.nonstandardSymbol = "Supports non-standard symbols. Make sure that your runtime environment supports these symbols." config.runtime.plugin = -"Plugin path. Please read [wiki](https://github.com/sumneko/lua-language-server/wiki/Plugins) to learn more." +"Plugin path. Please read [wiki](https://github.com/LuaLS/lua-language-server/wiki/Plugins) to learn more." config.runtime.pluginArgs = "Additional arguments for the plugin." config.runtime.fileEncoding = @@ -133,7 +135,7 @@ Automatic detection and adaptation of third-party libraries, currently supported * Jass ]] config.workspace.userThirdParty = -'Add private third-party library configuration file paths here, please refer to the built-in [configuration file path](https://github.com/sumneko/lua-language-server/tree/master/meta/3rd)' +'Add private third-party library configuration file paths here, please refer to the built-in [configuration file path](https://github.com/LuaLS/lua-language-server/tree/master/meta/3rd)' config.workspace.supportScheme = 'Provide language server for the Lua files of the following scheme.' config.completion.enable = @@ -269,20 +271,20 @@ config.spell.dict = 'Custom words for spell checking.' config.telemetry.enable = [[ -Enable telemetry to send your editor information and error logs over the network. Read our privacy policy [here](https://github.com/sumneko/lua-language-server/wiki/Home#privacy). +Enable telemetry to send your editor information and error logs over the network. Read our privacy policy [here](https://github.com/LuaLS/lua-language-server/wiki/Home#privacy). ]] config.misc.parameters = -'[Command line parameters](https://github.com/sumneko/lua-telemetry-server/tree/master/method) when starting the language server in VSCode.' +'[Command line parameters](https://github.com/LuaLS/lua-telemetry-server/tree/master/method) when starting the language server in VSCode.' config.misc.executablePath = 'Specify the executable path in VSCode.' config.IntelliSense.traceLocalSet = -'Please read [wiki](https://github.com/sumneko/lua-language-server/wiki/IntelliSense-optional-features) to learn more.' +'Please read [wiki](https://github.com/LuaLS/lua-language-server/wiki/IntelliSense-optional-features) to learn more.' config.IntelliSense.traceReturn = -'Please read [wiki](https://github.com/sumneko/lua-language-server/wiki/IntelliSense-optional-features) to learn more.' +'Please read [wiki](https://github.com/LuaLS/lua-language-server/wiki/IntelliSense-optional-features) to learn more.' config.IntelliSense.traceBeSetted = -'Please read [wiki](https://github.com/sumneko/lua-language-server/wiki/IntelliSense-optional-features) to learn more.' +'Please read [wiki](https://github.com/LuaLS/lua-language-server/wiki/IntelliSense-optional-features) to learn more.' config.IntelliSense.traceFieldInject = -'Please read [wiki](https://github.com/sumneko/lua-language-server/wiki/IntelliSense-optional-features) to learn more.' +'Please read [wiki](https://github.com/LuaLS/lua-language-server/wiki/IntelliSense-optional-features) to learn more.' config.type.castNumberToInteger = 'Allowed to assign the `number` type to the `integer` type.' config.type.weakUnionCheck = @@ -421,3 +423,8 @@ config.typeFormat.config.auto_complete_table_sep = 'Controls if a separator is automatically appended at the end of a table declaration.' config.typeFormat.config.format_line = 'Controls if a line is formatted at all.' + +command.exportDocument = +'Lua: Export Document ...' +command.addon_manager.open = +'Lua: Open Addon Manager ...' diff --git a/locale/pt-br/script.lua b/locale/pt-br/script.lua index a221dffe..d2a7c314 100644 --- a/locale/pt-br/script.lua +++ b/locale/pt-br/script.lua @@ -177,7 +177,7 @@ WORKSPACE_DIAGNOSTIC = WORKSPACE_SKIP_HUGE_FILE = 'Por motivos de desempenho, a análise deste arquivo foi interrompida: {}' WORKSPACE_NOT_ALLOWED = -'Seu espaço de trabalho foi definido para `{}`. Servidor da linguagem Lua recusou o carregamneto neste diretório. Por favor, cheque sua configuração. [aprenda mais aqui](https://github.com/sumneko/lua-language-server/wiki/FAQ#why-is-the-server-scanning-the-wrong-folder)' +'Seu espaço de trabalho foi definido para `{}`. Servidor da linguagem Lua recusou o carregamneto neste diretório. Por favor, cheque sua configuração. [aprenda mais aqui](https://github.com/LuaLS/lua-language-server/wiki/FAQ#why-is-the-server-scanning-the-wrong-folder)' WORKSPACE_SCAN_TOO_MUCH = -- TODO: need translate! 'Mais do que {} arquivos foram escaneados. O diretório atual escaneado é `{}`. Por favor, confirmar se a configuração está correta' @@ -281,6 +281,8 @@ PARSER_NEED_PAREN = -- TODO: need translate! '需要添加一对括号。' PARSER_NESTING_LONG_MARK = -- TODO: need translate! 'Nesting of `[[...]]` is not allowed in Lua 5.1 .' +PARSER_LOCAL_LIMIT = -- TODO: need translate! +'Only 200 active local variables and upvalues can be existed at the same time.' PARSER_LUADOC_MISS_CLASS_NAME = 'Esperado <class name>.' PARSER_LUADOC_MISS_EXTENDS_SYMBOL = @@ -528,7 +530,7 @@ WINDOW_APPLY_SETTING = WINDOW_CHECK_SEMANTIC = 'Se você estiver usando o tema de cores do market, talvez seja necessário modificar `editor.semanticHighlighting.enabled` para `true` para fazer com tokens semânticas sejam habilitados.' WINDOW_TELEMETRY_HINT = -'Por favor, permita o envio de dados de uso e relatórios de erro anônimos para nos ajudar a melhorar ainda mais essa extensão. Leia nossa política de privacidade [aqui](https://github.com/sumneko/lua-language-server/wiki/Home#privacy) .' +'Por favor, permita o envio de dados de uso e relatórios de erro anônimos para nos ajudar a melhorar ainda mais essa extensão. Leia nossa política de privacidade [aqui](https://github.com/LuaLS/lua-language-server/wiki/Home#privacy) .' WINDOW_TELEMETRY_ENABLE = 'Permitir' WINDOW_TELEMETRY_DISABLE = @@ -568,6 +570,22 @@ CONFIG_TYPE_ERROR = 'O arquivo de configuração deve estar no formato LUA ou JSON: {}' CONFIG_MODIFY_FAIL_SYNTAX_ERROR = -- TODO: need translate! 'Failed to modify settings, there are syntax errors in the settings file: {}' +CONFIG_MODIFY_FAIL_NO_WORKSPACE = -- TODO: need translate! +[[ +Failed to modify settings: +* The current mode is single-file mode, server cannot create `.luarc.json` without workspace. +* The language client dose not support modifying settings from the server side. + +Please modify following settings manually: +{} +]] +CONFIG_MODIFY_FAIL = -- TODO: need translate! +[[ +Failed to modify settings + +Please modify following settings manually: +{} +]] PLUGIN_RUNTIME_ERROR = [[ @@ -602,6 +620,14 @@ CLI_CHECK_SUCCESS = 'Diagnóstico completo, nenhum problema encontrado' CLI_CHECK_RESULTS = 'Diagnóstico completo, {} problemas encontrados, veja {}' +CLI_DOC_INITING = -- TODO: need translate! +'Loading documents ...' +CLI_DOC_DONE = -- TODO: need translate! +[[ +Document exporting completed! +Raw data: {} +Markdown(example): {} +]] TYPE_ERROR_ENUM_GLOBAL_DISMATCH = -- TODO: need translate! 'Type `{child}` cannot match enumeration type of `{parent}`' @@ -649,7 +675,7 @@ Defines a class/table structure Manager = {} ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#class) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#class) ]=] LUADOC_DESC_TYPE = -- TODO: need translate! [=[ @@ -700,7 +726,7 @@ local x --x[""] is true local myFunction ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#types-and-type) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#types-and-type) ]=] LUADOC_DESC_ALIAS = -- TODO: need translate! [=[ @@ -750,7 +776,7 @@ local enums = { ---| `enums.CLOSE` ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#alias) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#alias) ]=] LUADOC_DESC_PARAM = -- TODO: need translate! [=[ @@ -775,7 +801,7 @@ function get(url, headers, timeout) end function concat(base, ...) end ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#param) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#param) ]=] LUADOC_DESC_RETURN = -- TODO: need translate! [=[ @@ -813,7 +839,7 @@ function getFirstLast() end function getTags(item) end ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#return) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#return) ]=] LUADOC_DESC_FIELD = -- TODO: need translate! [=[ @@ -844,7 +870,7 @@ response = get("localhost") statusCode = response.status.code ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#field) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#field) ]=] LUADOC_DESC_GENERIC = -- TODO: need translate! [=[ @@ -901,7 +927,7 @@ local v = Generic("Foo") -- v is an object of Foo -- we give for key (K) or value (V) ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#generics-and-generic) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#generics-and-generic) ]=] LUADOC_DESC_VARARG = -- TODO: need translate! [=[ @@ -920,7 +946,7 @@ provide typing or allow descriptions. function concat(...) end ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#vararg) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#vararg) ]=] LUADOC_DESC_OVERLOAD = -- TODO: need translate! [=[ @@ -935,7 +961,7 @@ Allows defining of multiple function signatures. function table.insert(t, position, value) end ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#overload) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#overload) ]=] LUADOC_DESC_DEPRECATED = -- TODO: need translate! [=[ @@ -946,7 +972,7 @@ being ~~struck through~~. `---@deprecated` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#deprecated) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#deprecated) ]=] LUADOC_DESC_META = -- TODO: need translate! [=[ @@ -961,7 +987,7 @@ There are 3 main distinctions to note with meta files: `---@meta` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#meta) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#meta) ]=] LUADOC_DESC_VERSION = -- TODO: need translate! [=[ @@ -986,7 +1012,7 @@ function onlyWorksInJIT() end function oldLuaOnly() end ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#version) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#version) ]=] LUADOC_DESC_SEE = -- TODO: need translate! [=[ @@ -996,7 +1022,7 @@ Define something that can be viewed for more information `---@see <text>` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#see) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#see) ]=] LUADOC_DESC_DIAGNOSTIC = -- TODO: need translate! [=[ @@ -1004,7 +1030,7 @@ Enable/disable diagnostics for error/warnings/etc. Actions: `disable`, `enable`, `disable-line`, `disable-next-line` -[Names](https://github.com/sumneko/lua-language-server/blob/cbb6e6224094c4eb874ea192c5f85a6cba099588/script/proto/define.lua#L54) +[Names](https://github.com/LuaLS/lua-language-server/blob/cbb6e6224094c4eb874ea192c5f85a6cba099588/script/proto/define.lua#L54) ## Syntax `---@diagnostic <action>[: <name>]` @@ -1022,7 +1048,7 @@ local unused = "hello world" ---@diagnostic enable: unused-local ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#diagnostic) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#diagnostic) ]=] LUADOC_DESC_MODULE = -- TODO: need translate! [=[ @@ -1039,7 +1065,7 @@ local stringUtils local module = require('string.utils') ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#module) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#module) ]=] LUADOC_DESC_ASYNC = -- TODO: need translate! [=[ @@ -1049,7 +1075,7 @@ Marks a function as asynchronous. `---@async` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#async) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#async) ]=] LUADOC_DESC_NODISCARD = -- TODO: need translate! [=[ @@ -1061,7 +1087,7 @@ be ignored. `---@nodiscard` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#nodiscard) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#nodiscard) ]=] LUADOC_DESC_CAST = -- TODO: need translate! [=[ @@ -1096,7 +1122,7 @@ local x --> string|table print(x) --> table ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#cast) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#cast) ]=] LUADOC_DESC_OPERATOR = -- TODO: need translate! [=[ @@ -1126,12 +1152,12 @@ pA = Passcode.new(1234) pB = -pA --> integer ``` -[View Request](https://github.com/sumneko/lua-language-server/issues/599) +[View Request](https://github.com/LuaLS/lua-language-server/issues/599) ]=] LUADOC_DESC_ENUM = -- TODO: need translate! [=[ Mark a table as an enum. If you want an enum but can't define it as a Lua -table, take a look at the [`@alias`](https://github.com/sumneko/lua-language-server/wiki/Annotations#alias) +table, take a look at the [`@alias`](https://github.com/LuaLS/lua-language-server/wiki/Annotations#alias) tag. ## Syntax diff --git a/locale/pt-br/setting.lua b/locale/pt-br/setting.lua index be21a0ee..75904872 100644 --- a/locale/pt-br/setting.lua +++ b/locale/pt-br/setting.lua @@ -1,5 +1,7 @@ ---@diagnostic disable: undefined-global +config.addonManager.enable = -- TODO: need translate! +"Whether the addon manager is enabled or not." config.runtime.version = -- TODO: need translate! "Lua runtime version." config.runtime.path = -- TODO: need translate! @@ -25,7 +27,7 @@ config.runtime.unicodeName = -- TODO: need translate! config.runtime.nonstandardSymbol = -- TODO: need translate! "Supports non-standard symbols. Make sure that your runtime environment supports these symbols." config.runtime.plugin = -- TODO: need translate! -"Plugin path. Please read [wiki](https://github.com/sumneko/lua-language-server/wiki/Plugins) to learn more." +"Plugin path. Please read [wiki](https://github.com/LuaLS/lua-language-server/wiki/Plugins) to learn more." config.runtime.pluginArgs = -- TODO: need translate! "Additional arguments for the plugin." config.runtime.fileEncoding = -- TODO: need translate! @@ -133,7 +135,7 @@ Automatic detection and adaptation of third-party libraries, currently supported * Jass ]] config.workspace.userThirdParty = -- TODO: need translate! -'Add private third-party library configuration file paths here, please refer to the built-in [configuration file path](https://github.com/sumneko/lua-language-server/tree/master/meta/3rd)' +'Add private third-party library configuration file paths here, please refer to the built-in [configuration file path](https://github.com/LuaLS/lua-language-server/tree/master/meta/3rd)' config.workspace.supportScheme = -- TODO: need translate! 'Provide language server for the Lua files of the following scheme.' config.completion.enable = -- TODO: need translate! @@ -269,20 +271,20 @@ config.spell.dict = -- TODO: need translate! 'Custom words for spell checking.' config.telemetry.enable = -- TODO: need translate! [[ -Enable telemetry to send your editor information and error logs over the network. Read our privacy policy [here](https://github.com/sumneko/lua-language-server/wiki/Home#privacy). +Enable telemetry to send your editor information and error logs over the network. Read our privacy policy [here](https://github.com/LuaLS/lua-language-server/wiki/Home#privacy). ]] config.misc.parameters = -- TODO: need translate! -'[Command line parameters](https://github.com/sumneko/lua-telemetry-server/tree/master/method) when starting the language service in VSCode.' +'[Command line parameters](https://github.com/LuaLS/lua-telemetry-server/tree/master/method) when starting the language service in VSCode.' config.misc.executablePath = -- TODO: need translate! 'Specify the executable path in VSCode.' config.IntelliSense.traceLocalSet = -- TODO: need translate! -'Please read [wiki](https://github.com/sumneko/lua-language-server/wiki/IntelliSense-optional-features) to learn more.' +'Please read [wiki](https://github.com/LuaLS/lua-language-server/wiki/IntelliSense-optional-features) to learn more.' config.IntelliSense.traceReturn = -- TODO: need translate! -'Please read [wiki](https://github.com/sumneko/lua-language-server/wiki/IntelliSense-optional-features) to learn more.' +'Please read [wiki](https://github.com/LuaLS/lua-language-server/wiki/IntelliSense-optional-features) to learn more.' config.IntelliSense.traceBeSetted = -- TODO: need translate! -'Please read [wiki](https://github.com/sumneko/lua-language-server/wiki/IntelliSense-optional-features) to learn more.' +'Please read [wiki](https://github.com/LuaLS/lua-language-server/wiki/IntelliSense-optional-features) to learn more.' config.IntelliSense.traceFieldInject = -- TODO: need translate! -'Please read [wiki](https://github.com/sumneko/lua-language-server/wiki/IntelliSense-optional-features) to learn more.' +'Please read [wiki](https://github.com/LuaLS/lua-language-server/wiki/IntelliSense-optional-features) to learn more.' config.type.castNumberToInteger = -- TODO: need translate! 'Allowed to assign the `number` type to the `integer` type.' config.type.weakUnionCheck = -- TODO: need translate! @@ -421,3 +423,8 @@ config.typeFormat.config.auto_complete_table_sep = -- TODO: need translate! 'Controls if a separator is automatically appended at the end of a table declaration.' config.typeFormat.config.format_line = -- TODO: need translate! 'Controls if a line is formatted at all.' + +command.exportDocument = -- TODO: need translate! +'Lua: Export Document ...' +command.addon_manager.open = -- TODO: need translate! +'Lua: Open Addon Manager ...' diff --git a/locale/zh-cn/script.lua b/locale/zh-cn/script.lua index 92019b02..531b54ae 100644 --- a/locale/zh-cn/script.lua +++ b/locale/zh-cn/script.lua @@ -177,7 +177,7 @@ WORKSPACE_DIAGNOSTIC = WORKSPACE_SKIP_HUGE_FILE = '出于性能考虑,已停止对此文件解析:{}' WORKSPACE_NOT_ALLOWED = -'你的工作目录被设置为了 `{}`,Lua语言服务拒绝加载此目录,请检查你的配置。[了解更多](https://github.com/sumneko/lua-language-server/wiki/FAQ#why-is-the-server-scanning-the-wrong-folder)' +'你的工作目录被设置为了 `{}`,Lua语言服务拒绝加载此目录,请检查你的配置。[了解更多](https://github.com/LuaLS/lua-language-server/wiki/FAQ#why-is-the-server-scanning-the-wrong-folder)' WORKSPACE_SCAN_TOO_MUCH = '已扫描了超过 {} 个文件,当前扫描的目录为 `{}`,请确认配置是否正确。' @@ -281,6 +281,8 @@ PARSER_NEED_PAREN = '需要添加一对括号。' PARSER_NESTING_LONG_MARK = 'Lua 5.1 中不允许使用嵌套的 `[[...]]` 。' +PARSER_LOCAL_LIMIT = +'只能同时存在200个活跃的局部变量与上值。' PARSER_LUADOC_MISS_CLASS_NAME = '缺少类名称。' PARSER_LUADOC_MISS_EXTENDS_SYMBOL = @@ -528,7 +530,7 @@ WINDOW_APPLY_SETTING = WINDOW_CHECK_SEMANTIC = '如果你正在使用市场中的颜色主题,你可能需要同时修改 `editor.semanticHighlighting.enabled` 选项为 `true` 才会使语义着色生效。' WINDOW_TELEMETRY_HINT = -'请允许发送匿名的使用数据与错误报告,帮助我们进一步完善此插件。在[此处](https://github.com/sumneko/lua-language-server/wiki/Home#privacy)阅读我们的隐私声明。' +'请允许发送匿名的使用数据与错误报告,帮助我们进一步完善此插件。在[此处](https://github.com/LuaLS/lua-language-server/wiki/Home#privacy)阅读我们的隐私声明。' WINDOW_TELEMETRY_ENABLE = '允许' WINDOW_TELEMETRY_DISABLE = @@ -538,7 +540,7 @@ WINDOW_CLIENT_NOT_SUPPORT_CONFIG = WINDOW_LCONFIG_NOT_SUPPORT_CONFIG= '暂不支持自动修改本地设置,请手动修改如下设置:' WINDOW_MANUAL_CONFIG_ADD = -'为 `{key}` 添加值 `{value:q}`;' +'为 `{key}` 添加元素 `{value:q}`;' WINDOW_MANUAL_CONFIG_SET = '将 `{key}` 的值设置为 `{value:q}`;' WINDOW_MANUAL_CONFIG_PROP = @@ -568,6 +570,22 @@ CONFIG_TYPE_ERROR = '设置文件必须是lua或json格式:{}' CONFIG_MODIFY_FAIL_SYNTAX_ERROR = '修改设置失败,设置文件中有语法错误:{}' +CONFIG_MODIFY_FAIL_NO_WORKSPACE = +[[ +修改设置失败: +* 当前模式为单文件模式,服务器只能在工作区中创建 `.luarc.json` 文件。 +* 语言客户端不支持从服务器侧修改设置。 + +请手动修改以下设置: +{} +]] +CONFIG_MODIFY_FAIL = +[[ +修改设置失败 + +请手动修改以下设置: +{} +]] PLUGIN_RUNTIME_ERROR = [[ @@ -602,6 +620,14 @@ CLI_CHECK_SUCCESS = '诊断完成,没有发现问题' CLI_CHECK_RESULTS = '诊断完成,共有 {} 个问题,请查看 {}' +CLI_DOC_INITING = +'加载文档 ...' +CLI_DOC_DONE = +[[ +文档导出完成! +原始数据: {} +Markdown(演示用): {} +]] TYPE_ERROR_ENUM_GLOBAL_DISMATCH = '类型 `{child}` 无法匹配 `{parent}` 的枚举类型' @@ -649,7 +675,7 @@ Defines a class/table structure Manager = {} ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#class) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#class) ]=] LUADOC_DESC_TYPE = -- TODO: need translate! [=[ @@ -700,7 +726,7 @@ local x --x[""] is true local myFunction ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#types-and-type) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#types-and-type) ]=] LUADOC_DESC_ALIAS = -- TODO: need translate! [=[ @@ -750,7 +776,7 @@ local enums = { ---| `enums.CLOSE` ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#alias) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#alias) ]=] LUADOC_DESC_PARAM = -- TODO: need translate! [=[ @@ -775,7 +801,7 @@ function get(url, headers, timeout) end function concat(base, ...) end ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#param) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#param) ]=] LUADOC_DESC_RETURN = -- TODO: need translate! [=[ @@ -813,7 +839,7 @@ function getFirstLast() end function getTags(item) end ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#return) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#return) ]=] LUADOC_DESC_FIELD = -- TODO: need translate! [=[ @@ -844,7 +870,7 @@ response = get("localhost") statusCode = response.status.code ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#field) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#field) ]=] LUADOC_DESC_GENERIC = -- TODO: need translate! [=[ @@ -901,7 +927,7 @@ local v = Generic("Foo") -- v is an object of Foo -- we give for key (K) or value (V) ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#generics-and-generic) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#generics-and-generic) ]=] LUADOC_DESC_VARARG = -- TODO: need translate! [=[ @@ -920,7 +946,7 @@ provide typing or allow descriptions. function concat(...) end ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#vararg) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#vararg) ]=] LUADOC_DESC_OVERLOAD = -- TODO: need translate! [=[ @@ -935,7 +961,7 @@ Allows defining of multiple function signatures. function table.insert(t, position, value) end ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#overload) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#overload) ]=] LUADOC_DESC_DEPRECATED = -- TODO: need translate! [=[ @@ -946,7 +972,7 @@ being ~~struck through~~. `---@deprecated` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#deprecated) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#deprecated) ]=] LUADOC_DESC_META = -- TODO: need translate! [=[ @@ -961,7 +987,7 @@ There are 3 main distinctions to note with meta files: `---@meta` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#meta) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#meta) ]=] LUADOC_DESC_VERSION = -- TODO: need translate! [=[ @@ -986,7 +1012,7 @@ function onlyWorksInJIT() end function oldLuaOnly() end ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#version) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#version) ]=] LUADOC_DESC_SEE = -- TODO: need translate! [=[ @@ -996,7 +1022,7 @@ Define something that can be viewed for more information `---@see <text>` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#see) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#see) ]=] LUADOC_DESC_DIAGNOSTIC = -- TODO: need translate! [=[ @@ -1004,7 +1030,7 @@ Enable/disable diagnostics for error/warnings/etc. Actions: `disable`, `enable`, `disable-line`, `disable-next-line` -[Names](https://github.com/sumneko/lua-language-server/blob/cbb6e6224094c4eb874ea192c5f85a6cba099588/script/proto/define.lua#L54) +[Names](https://github.com/LuaLS/lua-language-server/blob/cbb6e6224094c4eb874ea192c5f85a6cba099588/script/proto/define.lua#L54) ## Syntax `---@diagnostic <action>[: <name>]` @@ -1022,7 +1048,7 @@ local unused = "hello world" ---@diagnostic enable: unused-local ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#diagnostic) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#diagnostic) ]=] LUADOC_DESC_MODULE = -- TODO: need translate! [=[ @@ -1039,7 +1065,7 @@ local stringUtils local module = require('string.utils') ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#module) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#module) ]=] LUADOC_DESC_ASYNC = -- TODO: need translate! [=[ @@ -1049,7 +1075,7 @@ Marks a function as asynchronous. `---@async` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#async) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#async) ]=] LUADOC_DESC_NODISCARD = -- TODO: need translate! [=[ @@ -1061,7 +1087,7 @@ be ignored. `---@nodiscard` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#nodiscard) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#nodiscard) ]=] LUADOC_DESC_CAST = -- TODO: need translate! [=[ @@ -1096,7 +1122,7 @@ local x --> string|table print(x) --> table ``` --- -[View Wiki](https://github.com/sumneko/lua-language-server/wiki/Annotations#cast) +[View Wiki](https://github.com/LuaLS/lua-language-server/wiki/Annotations#cast) ]=] LUADOC_DESC_OPERATOR = -- TODO: need translate! [=[ @@ -1126,12 +1152,12 @@ pA = Passcode.new(1234) pB = -pA --> integer ``` -[View Request](https://github.com/sumneko/lua-language-server/issues/599) +[View Request](https://github.com/LuaLS/lua-language-server/issues/599) ]=] LUADOC_DESC_ENUM = -- TODO: need translate! [=[ Mark a table as an enum. If you want an enum but can't define it as a Lua -table, take a look at the [`@alias`](https://github.com/sumneko/lua-language-server/wiki/Annotations#alias) +table, take a look at the [`@alias`](https://github.com/LuaLS/lua-language-server/wiki/Annotations#alias) tag. ## Syntax diff --git a/locale/zh-cn/setting.lua b/locale/zh-cn/setting.lua index bdb1e779..d488ac3f 100644 --- a/locale/zh-cn/setting.lua +++ b/locale/zh-cn/setting.lua @@ -1,5 +1,7 @@ ---@diagnostic disable: undefined-global +config.addonManager.enable = -- TODO: need translate! +"Whether the addon manager is enabled or not." config.runtime.version = "Lua运行版本。" config.runtime.path = @@ -25,7 +27,7 @@ config.runtime.unicodeName = config.runtime.nonstandardSymbol = "支持非标准的符号。请务必确认你的运行环境支持这些符号。" config.runtime.plugin = -"插件路径,请查阅[文档](https://github.com/sumneko/lua-language-server/wiki/Plugins)了解用法。" +"插件路径,请查阅[文档](https://github.com/LuaLS/lua-language-server/wiki/Plugins)了解用法。" config.runtime.pluginArgs = -- TODO: need translate! "Additional arguments for the plugin." config.runtime.fileEncoding = @@ -132,7 +134,7 @@ config.workspace.checkThirdParty = * Jass ]] config.workspace.userThirdParty = -'在这里添加私有的第三方库适配文件路径,请参考内置的[配置文件路径](https://github.com/sumneko/lua-language-server/tree/master/meta/3rd)' +'在这里添加私有的第三方库适配文件路径,请参考内置的[配置文件路径](https://github.com/LuaLS/lua-language-server/tree/master/meta/3rd)' config.workspace.supportScheme = '为以下 scheme 的lua文件提供语言服务。' config.completion.enable = @@ -268,20 +270,20 @@ config.spell.dict = '拼写检查的自定义单词。' config.telemetry.enable = [[ -启用遥测,通过网络发送你的编辑器信息与错误日志。在[此处](https://github.com/sumneko/lua-language-server/wiki/Home#privacy)阅读我们的隐私声明。 +启用遥测,通过网络发送你的编辑器信息与错误日志。在[此处](https://github.com/LuaLS/lua-language-server/wiki/Home#privacy)阅读我们的隐私声明。 ]] config.misc.parameters = -'VSCode中启动语言服务时的[命令行参数](https://github.com/sumneko/lua-language-server/wiki/Getting-Started#arguments)。' +'VSCode中启动语言服务时的[命令行参数](https://github.com/LuaLS/lua-language-server/wiki/Getting-Started#arguments)。' config.misc.executablePath = 'VSCode中指定可执行文件路径。' config.IntelliSense.traceLocalSet = -'请查阅[文档](https://github.com/sumneko/lua-language-server/wiki/IntelliSense-optional-features)了解用法。' +'请查阅[文档](https://github.com/LuaLS/lua-language-server/wiki/IntelliSense-optional-features)了解用法。' config.IntelliSense.traceReturn = -'请查阅[文档](https://github.com/sumneko/lua-language-server/wiki/IntelliSense-optional-features)了解用法。' +'请查阅[文档](https://github.com/LuaLS/lua-language-server/wiki/IntelliSense-optional-features)了解用法。' config.IntelliSense.traceBeSetted = -'请查阅[文档](https://github.com/sumneko/lua-language-server/wiki/IntelliSense-optional-features)了解用法。' +'请查阅[文档](https://github.com/LuaLS/lua-language-server/wiki/IntelliSense-optional-features)了解用法。' config.IntelliSense.traceFieldInject = -'请查阅[文档](https://github.com/sumneko/lua-language-server/wiki/IntelliSense-optional-features)了解用法。' +'请查阅[文档](https://github.com/LuaLS/lua-language-server/wiki/IntelliSense-optional-features)了解用法。' config.type.castNumberToInteger = '允许将 `number` 类型赋给 `integer` 类型。' config.type.weakUnionCheck = @@ -420,3 +422,8 @@ config.typeFormat.config.auto_complete_table_sep = -- TODO: need translate! 'Controls if a separator is automatically appended at the end of a table declaration.' config.typeFormat.config.format_line = -- TODO: need translate! 'Controls if a line is formatted at all.' + +command.exportDocument = +'Lua: 导出文档...' +command.addon_manager.open = +'Lua: 打开插件管理器...' diff --git a/locale/zh-tw/script.lua b/locale/zh-tw/script.lua index 13c50a8d..d6e93a43 100644 --- a/locale/zh-tw/script.lua +++ b/locale/zh-tw/script.lua @@ -177,7 +177,7 @@ WORKSPACE_DIAGNOSTIC = WORKSPACE_SKIP_HUGE_FILE = '出於效能考慮,已停止對此檔案解析:{}' WORKSPACE_NOT_ALLOWED = -'你的工作目錄被設定為了 `{}` ,Lua語言伺服拒絕載入此目錄,請檢查你的設定檔。[了解更多](https://github.com/sumneko/lua-language-server/wiki/FAQ#why-is-the-server-scanning-the-wrong-folder)' +'你的工作目錄被設定為了 `{}` ,Lua語言伺服拒絕載入此目錄,請檢查你的設定檔。[了解更多](https://github.com/LuaLS/lua-language-server/wiki/FAQ#why-is-the-server-scanning-the-wrong-folder)' WORKSPACE_SCAN_TOO_MUCH = '已掃描了超過 {} 個檔案,目前掃描的目錄為 `{}`,請確認設定檔是否正確。' @@ -281,6 +281,8 @@ PARSER_NEED_PAREN = -- TODO: need translate! '需要添加一对括号。' PARSER_NESTING_LONG_MARK = -- TODO: need translate! 'Nesting of `[[...]]` is not allowed in Lua 5.1 .' +PARSER_LOCAL_LIMIT = -- TODO: need translate! +'Only 200 active local variables and upvalues can be existed at the same time.' PARSER_LUADOC_MISS_CLASS_NAME = '缺少類別名稱。' PARSER_LUADOC_MISS_EXTENDS_SYMBOL = @@ -528,7 +530,7 @@ WINDOW_APPLY_SETTING = WINDOW_CHECK_SEMANTIC = '如果你正在使用市場中的顏色主題,你可能需要同時修改 `editor.semanticHighlighting.enabled` 選項為 `true` 才會使語義著色生效。' WINDOW_TELEMETRY_HINT = -'請允許發送匿名的使用資料與錯誤報告,幫助我們進一步完善此延伸模組。在[此處](https://github.com/sumneko/lua-language-server/wiki/Home#privacy)閱讀我們的隱私聲明。' +'請允許發送匿名的使用資料與錯誤報告,幫助我們進一步完善此延伸模組。在[此處](https://github.com/LuaLS/lua-language-server/wiki/Home#privacy)閱讀我們的隱私聲明。' WINDOW_TELEMETRY_ENABLE = '允許' WINDOW_TELEMETRY_DISABLE = @@ -568,6 +570,22 @@ CONFIG_TYPE_ERROR = '設定檔案必須是lua或json格式:{}' CONFIG_MODIFY_FAIL_SYNTAX_ERROR = -- TODO: need translate! 'Failed to modify settings, there are syntax errors in the settings file: {}' +CONFIG_MODIFY_FAIL_NO_WORKSPACE = -- TODO: need translate! +[[ +Failed to modify settings: +* The current mode is single-file mode, server cannot create `.luarc.json` without workspace. +* The language client dose not support modifying settings from the server side. + +Please modify following settings manually: +{} +]] +CONFIG_MODIFY_FAIL = -- TODO: need translate! +[[ +Failed to modify settings + +Please modify following settings manually: +{} +]] PLUGIN_RUNTIME_ERROR = [[ @@ -602,6 +620,14 @@ CLI_CHECK_SUCCESS = '診斷完成,沒有發現問題' CLI_CHECK_RESULTS = '診斷完成,共有 {} 個問題,請查看 {}' +CLI_DOC_INITING = -- TODO: need translate! +'Loading documents ...' +CLI_DOC_DONE = -- TODO: need translate! +[[ +Document exporting completed! +Raw data: {} +Markdown(example): {} +]] TYPE_ERROR_ENUM_GLOBAL_DISMATCH = -- TODO: need translate! 'Type `{child}` cannot match enumeration type of `{parent}`' @@ -649,7 +675,7 @@ LUADOC_DESC_CLASS = Manager = {} ``` --- -[檢視文件](https://github.com/sumneko/lua-language-server/wiki/Annotations#class) +[檢視文件](https://github.com/LuaLS/lua-language-server/wiki/Annotations#class) ]=] LUADOC_DESC_TYPE = [=[ @@ -700,7 +726,7 @@ local x --x[""] is true local myFunction ``` --- -[檢視文件](https://github.com/sumneko/lua-language-server/wiki/Annotations#types-and-type) +[檢視文件](https://github.com/LuaLS/lua-language-server/wiki/Annotations#types-and-type) ]=] LUADOC_DESC_ALIAS = [=[ @@ -750,7 +776,7 @@ local enums = { ---| `enums.CLOSE` ``` --- -[檢視文件](https://github.com/sumneko/lua-language-server/wiki/Annotations#alias) +[檢視文件](https://github.com/LuaLS/lua-language-server/wiki/Annotations#alias) ]=] LUADOC_DESC_PARAM = [=[ @@ -775,7 +801,7 @@ function get(url, headers, timeout) end function concat(base, ...) end ``` --- -[檢視文件](https://github.com/sumneko/lua-language-server/wiki/Annotations#param) +[檢視文件](https://github.com/LuaLS/lua-language-server/wiki/Annotations#param) ]=] LUADOC_DESC_RETURN = [=[ @@ -813,7 +839,7 @@ function getFirstLast() end function getTags(item) end ``` --- -[檢視文件](https://github.com/sumneko/lua-language-server/wiki/Annotations#return) +[檢視文件](https://github.com/LuaLS/lua-language-server/wiki/Annotations#return) ]=] LUADOC_DESC_FIELD = [=[ @@ -842,7 +868,7 @@ response = get("localhost") statusCode = response.status.code ``` --- -[檢視文件](https://github.com/sumneko/lua-language-server/wiki/Annotations#field) +[檢視文件](https://github.com/LuaLS/lua-language-server/wiki/Annotations#field) ]=] LUADOC_DESC_GENERIC = [=[ @@ -898,7 +924,7 @@ local v = Generic("Foo") -- v is an object of Foo -- we give for key (K) or value (V) ``` --- -[檢視文件](https://github.com/sumneko/lua-language-server/wiki/Annotations#generics-and-generic) +[檢視文件](https://github.com/LuaLS/lua-language-server/wiki/Annotations#generics-and-generic) ]=] LUADOC_DESC_VARARG = [=[ @@ -916,7 +942,7 @@ LUADOC_DESC_VARARG = function concat(...) end ``` --- -[檢視文件](https://github.com/sumneko/lua-language-server/wiki/Annotations#vararg) +[檢視文件](https://github.com/LuaLS/lua-language-server/wiki/Annotations#vararg) ]=] LUADOC_DESC_OVERLOAD = [=[ @@ -931,7 +957,7 @@ LUADOC_DESC_OVERLOAD = function table.insert(t, position, value) end ``` --- -[檢視文件](https://github.com/sumneko/lua-language-server/wiki/Annotations#overload) +[檢視文件](https://github.com/LuaLS/lua-language-server/wiki/Annotations#overload) ]=] LUADOC_DESC_DEPRECATED = [=[ @@ -941,7 +967,7 @@ LUADOC_DESC_DEPRECATED = `---@deprecated` --- -[檢視文件](https://github.com/sumneko/lua-language-server/wiki/Annotations#deprecated) +[檢視文件](https://github.com/LuaLS/lua-language-server/wiki/Annotations#deprecated) ]=] LUADOC_DESC_META = [=[ @@ -956,7 +982,7 @@ LUADOC_DESC_META = `---@meta` --- -[檢視文件](https://github.com/sumneko/lua-language-server/wiki/Annotations#meta) +[檢視文件](https://github.com/LuaLS/lua-language-server/wiki/Annotations#meta) ]=] LUADOC_DESC_VERSION = [=[ @@ -981,7 +1007,7 @@ function onlyWorksInJIT() end function oldLuaOnly() end ``` --- -[檢視文件](https://github.com/sumneko/lua-language-server/wiki/Annotations#version) +[檢視文件](https://github.com/LuaLS/lua-language-server/wiki/Annotations#version) ]=] LUADOC_DESC_SEE = [=[ @@ -991,7 +1017,7 @@ LUADOC_DESC_SEE = `---@see <text>` --- -[檢視文件](https://github.com/sumneko/lua-language-server/wiki/Annotations#see) +[檢視文件](https://github.com/LuaLS/lua-language-server/wiki/Annotations#see) ]=] LUADOC_DESC_DIAGNOSTIC = [=[ @@ -999,7 +1025,7 @@ LUADOC_DESC_DIAGNOSTIC = 操作:`disable` 、 `enable` 、 `disable-line` 、 `disable-next-line` -[名稱](https://github.com/sumneko/lua-language-server/blob/cbb6e6224094c4eb874ea192c5f85a6cba099588/script/proto/define.lua#L54) +[名稱](https://github.com/LuaLS/lua-language-server/blob/cbb6e6224094c4eb874ea192c5f85a6cba099588/script/proto/define.lua#L54) ## 語法 `---@diagnostic <action>[: <name>]` @@ -1017,7 +1043,7 @@ local unused = "hello world" ---@diagnostic enable: unused-local ``` --- -[檢視文件](https://github.com/sumneko/lua-language-server/wiki/Annotations#diagnostic) +[檢視文件](https://github.com/LuaLS/lua-language-server/wiki/Annotations#diagnostic) ]=] LUADOC_DESC_MODULE = [=[ @@ -1034,7 +1060,7 @@ local stringUtils local module = require('string.utils') ``` --- -[檢視文件](https://github.com/sumneko/lua-language-server/wiki/Annotations#module) +[檢視文件](https://github.com/LuaLS/lua-language-server/wiki/Annotations#module) ]=] LUADOC_DESC_ASYNC = [=[ @@ -1044,7 +1070,7 @@ LUADOC_DESC_ASYNC = `---@async` --- -[檢視文件](https://github.com/sumneko/lua-language-server/wiki/Annotations#async) +[檢視文件](https://github.com/LuaLS/lua-language-server/wiki/Annotations#async) ]=] LUADOC_DESC_NODISCARD = [=[ @@ -1055,7 +1081,7 @@ LUADOC_DESC_NODISCARD = `---@nodiscard` --- -[檢視文件](https://github.com/sumneko/lua-language-server/wiki/Annotations#nodiscard) +[檢視文件](https://github.com/LuaLS/lua-language-server/wiki/Annotations#nodiscard) ]=] LUADOC_DESC_CAST = [=[ @@ -1090,7 +1116,7 @@ local x --> string|table print(x) --> table ``` --- -[檢視文件](https://github.com/sumneko/lua-language-server/wiki/Annotations#cast) +[檢視文件](https://github.com/LuaLS/lua-language-server/wiki/Annotations#cast) ]=] LUADOC_DESC_OPERATOR = -- TODO: need translate! [=[ @@ -1120,12 +1146,12 @@ pA = Passcode.new(1234) pB = -pA --> integer ``` -[View Request](https://github.com/sumneko/lua-language-server/issues/599) +[View Request](https://github.com/LuaLS/lua-language-server/issues/599) ]=] LUADOC_DESC_ENUM = -- TODO: need translate! [=[ Mark a table as an enum. If you want an enum but can't define it as a Lua -table, take a look at the [`@alias`](https://github.com/sumneko/lua-language-server/wiki/Annotations#alias) +table, take a look at the [`@alias`](https://github.com/LuaLS/lua-language-server/wiki/Annotations#alias) tag. ## Syntax diff --git a/locale/zh-tw/setting.lua b/locale/zh-tw/setting.lua index dfd647fd..8c74668d 100644 --- a/locale/zh-tw/setting.lua +++ b/locale/zh-tw/setting.lua @@ -1,5 +1,7 @@ ---@diagnostic disable: undefined-global +config.addonManager.enable = -- TODO: need translate! +"Whether the addon manager is enabled or not." config.runtime.version = "Lua執行版本。" config.runtime.path = @@ -25,7 +27,7 @@ config.runtime.unicodeName = config.runtime.nonstandardSymbol = "支援非標準的符號。請務必確認你的執行環境支援這些符號。" config.runtime.plugin = -"延伸模組路徑,請查閱[文件](https://github.com/sumneko/lua-language-server/wiki/Plugins)瞭解用法。" +"延伸模組路徑,請查閱[文件](https://github.com/LuaLS/lua-language-server/wiki/Plugins)瞭解用法。" config.runtime.pluginArgs = -- TODO: need translate! "Additional arguments for the plugin." config.runtime.fileEncoding = @@ -132,7 +134,7 @@ config.workspace.checkThirdParty = * Jass ]] config.workspace.userThirdParty = -'在這裡添加私有的第三方庫適應檔案路徑,請參考內建的[組態檔案路徑](https://github.com/sumneko/lua-language-server/tree/master/meta/3rd)' +'在這裡添加私有的第三方庫適應檔案路徑,請參考內建的[組態檔案路徑](https://github.com/LuaLS/lua-language-server/tree/master/meta/3rd)' config.workspace.supportScheme = '為以下 `scheme` 的lua檔案提供語言伺服。' config.completion.enable = @@ -268,20 +270,20 @@ config.spell.dict = '拼寫檢查的自訂單詞。' config.telemetry.enable = [[ -啟用遙測,透過網路發送你的編輯器資訊與錯誤日誌。在[此處](https://github.com/sumneko/lua-language-server/wiki/Home#privacy)閱讀我們的隱私聲明。 +啟用遙測,透過網路發送你的編輯器資訊與錯誤日誌。在[此處](https://github.com/LuaLS/lua-language-server/wiki/Home#privacy)閱讀我們的隱私聲明。 ]] config.misc.parameters = -'VSCode中啟動語言伺服時的[命令列參數](https://github.com/sumneko/lua-language-server/wiki/Getting-Started#arguments)。' +'VSCode中啟動語言伺服時的[命令列參數](https://github.com/LuaLS/lua-language-server/wiki/Getting-Started#arguments)。' config.misc.executablePath = -- TODO: need translate! 'Specify the executable path in VSCode.' config.IntelliSense.traceLocalSet = -'請查閱[文件](https://github.com/sumneko/lua-language-server/wiki/IntelliSense-optional-features)瞭解用法。' +'請查閱[文件](https://github.com/LuaLS/lua-language-server/wiki/IntelliSense-optional-features)瞭解用法。' config.IntelliSense.traceReturn = -'請查閱[文件](https://github.com/sumneko/lua-language-server/wiki/IntelliSense-optional-features)瞭解用法。' +'請查閱[文件](https://github.com/LuaLS/lua-language-server/wiki/IntelliSense-optional-features)瞭解用法。' config.IntelliSense.traceBeSetted = -'請查閱[文件](https://github.com/sumneko/lua-language-server/wiki/IntelliSense-optional-features)瞭解用法。' +'請查閱[文件](https://github.com/LuaLS/lua-language-server/wiki/IntelliSense-optional-features)瞭解用法。' config.IntelliSense.traceFieldInject = -'請查閱[文件](https://github.com/sumneko/lua-language-server/wiki/IntelliSense-optional-features)瞭解用法。' +'請查閱[文件](https://github.com/LuaLS/lua-language-server/wiki/IntelliSense-optional-features)瞭解用法。' config.type.castNumberToInteger = '允許將 `number` 類型賦值給 `integer` 類型。' config.type.weakUnionCheck = @@ -420,3 +422,8 @@ config.typeFormat.config.auto_complete_table_sep = -- TODO: need translate! 'Controls if a separator is automatically appended at the end of a table declaration.' config.typeFormat.config.format_line = -- TODO: need translate! 'Controls if a line is formatted at all.' + +command.exportDocument = -- TODO: need translate! +'Lua: Export Document ...' +command.addon_manager.open = -- TODO: need translate! +'Lua: Open Addon Manager ...' @@ -70,10 +70,11 @@ log.info('METAPATH:', METAPATH) log.info('VERSION:', version.getVersion()) require 'tracy' -require 'cli' xpcall(dofile, log.debug, (ROOT / 'debugger.lua'):string()) +require 'cli' + local _, service = xpcall(require, log.error, 'service') service.start() diff --git a/make.bat b/make.bat new file mode 100644 index 00000000..01cb1ddc --- /dev/null +++ b/make.bat @@ -0,0 +1,5 @@ +git submodule update --init --recursive +cd 3rd\luamake +call compile\install.bat +cd ..\.. +call 3rd\luamake\luamake.exe rebuild @@ -1,11 +1,18 @@ local lm = require 'luamake' -lm.bindir = "bin" lm.c = lm.compiler == 'msvc' and 'c89' or 'c11' lm.cxx = 'c++17' ----@diagnostic disable-next-line: codestyle-check -lm.EXE_DIR = "" +if lm.sanitize then + lm.mode = "debug" + lm.flags = "-fsanitize=address" + lm.gcc = { + ldflags = "-fsanitize=address" + } + lm.clang = { + ldflags = "-fsanitize=address" + } +end local includeCodeFormat = true @@ -47,19 +54,28 @@ lm:executable "lua-language-server" { } } +local platform = require 'bee.platform' +local exe = platform.OS == 'Windows' and ".exe" or "" + +lm:copy "copy_lua-language-server" { + input = lm.bindir .. "/lua-language-server" .. exe, + output = "bin/lua-language-server" .. exe, +} + lm:copy "copy_bootstrap" { input = "make/bootstrap.lua", - output = lm.bindir .. "/main.lua", + output = "bin/main.lua", } lm:msvc_copydll 'copy_vcrt' { type = "vcrt", - output = lm.bindir, + output = "bin", } lm:phony "all" { deps = { "lua-language-server", + "copy_lua-language-server", "copy_bootstrap", }, windows = { @@ -76,26 +92,30 @@ if lm.notest then return end -local platform = require 'bee.platform' -local exe = platform.OS == 'Windows' and ".exe" or "" +lm:rule "run-bee-test" { + lm.bindir .. "/lua-language-server" .. exe, "$in", + description = "Run test: $in.", + pool = "console", +} -lm:build "bee-test" { - lm.bindir .. "/lua-language-server" .. exe, "3rd/bee.lua/test/test.lua", +lm:rule "run-unit-test" { + "bin/lua-language-server" .. exe, "$in", + description = "Run test: $in.", pool = "console", - deps = { - "all", - } +} + +lm:build "bee-test" { + rule = "run-bee-test", + deps = { "lua-language-server", "copy_script" }, + input = "3rd/bee.lua/test/test.lua", } lm:build 'unit-test' { - lm.bindir .. "/lua-language-server" .. exe, 'test.lua', - pool = "console", - deps = { - "bee-test", - } + rule = "run-unit-test", + deps = { "bee-test", "all" }, + input = "test.lua", } lm:default { - "bee-test", "unit-test", } diff --git a/make.sh b/make.sh new file mode 100755 index 00000000..f0907391 --- /dev/null +++ b/make.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +git submodule update --init --recursive +pushd 3rd/luamake +./compile/install.sh +popd +./3rd/luamake/luamake rebuild diff --git a/make/code_format.lua b/make/code_format.lua index 387221b3..4d0764db 100644 --- a/make/code_format.lua +++ b/make/code_format.lua @@ -14,33 +14,21 @@ lm:source_set 'code_format' { -- codeFormatLib "CodeFormatLib/src/*.cpp", -- LuaParser - "LuaParser/src/*.cpp", - "LuaParser/src/LuaAstNode/LuaAstNode.cpp", + "LuaParser/src/**/*.cpp", -- Util "Util/src/StringUtil.cpp", "Util/src/Utf8.cpp", - --CodeService - "CodeService/src/*.cpp", - "CodeService/src/TypeFormat/*.cpp", - "CodeService/src/Spell/*.cpp", "Util/src/SymSpell/*.cpp", - "CodeService/src/FormatElement/*.cpp", - "CodeService/src/NameStyle/*.cpp" + --CodeService + "CodeService/src/**/*.cpp", }, windows = { - -- 不要开哦 - -- flasg = "/W3 /WX" + flags = "/utf-8", }, macos = { flags = "-Wall -Werror", - defines = "NOT_SUPPORT_FILE_SYSTEM" }, linux = { - defines = (function() - if lm.platform == "linux-arm64" then - return "NOT_SUPPORT_FILE_SYSTEM" - end - end)(), flags = "-Wall -Werror" } } diff --git a/make/modules.cpp b/make/modules.cpp index 802e6916..8cd6d2d9 100644 --- a/make/modules.cpp +++ b/make/modules.cpp @@ -1,4 +1,4 @@ -#include <bee/lua/binding.h> +#include <binding/binding.h> extern "C" int luaopen_lpeglabel (lua_State *L); static ::bee::lua::callfunc _init(::bee::lua::register_module, "lpeglabel", luaopen_lpeglabel); diff --git a/meta/3rd/example/plugin.lua b/meta/3rd/example/plugin.lua index 01162042..0ece12f5 100644 --- a/meta/3rd/example/plugin.lua +++ b/meta/3rd/example/plugin.lua @@ -1,5 +1,5 @@ -- if this file exists, then change setting `Lua.runtime.plugin` --- see https://github.com/sumneko/lua-language-server/wiki/Plugins +-- see https://github.com/LuaLS/lua-language-server/wiki/Plugins function OnSetText(uri, text) local diffs = {} diff --git a/meta/3rd/ffi-reflect/config.json b/meta/3rd/ffi-reflect/config.json new file mode 100644 index 00000000..544b7b4d --- /dev/null +++ b/meta/3rd/ffi-reflect/config.json @@ -0,0 +1,3 @@ +{ + +}
\ No newline at end of file diff --git a/meta/3rd/ffi-reflect/library/reflect.lua b/meta/3rd/ffi-reflect/library/reflect.lua new file mode 100644 index 00000000..8a9b759c --- /dev/null +++ b/meta/3rd/ffi-reflect/library/reflect.lua @@ -0,0 +1,128 @@ +---@meta + +---@alias ffi.typeinfo.what "int" +---|"void" +---|"float" +---|"enum" +---|"constant" +---|"ptr" +---|"ref" +---|"array" +---|"struct" +---|"union" +---|"func" +---|"field" +---|"bitfield" +---|"typedef" + +---@class ffi.typeinfo +---@field what ffi.typeinfo.what + +---@class ffi.enuminfo : ffi.typeinfo +---@field name string? +---@field size number|string +---@field alignment number +---@field type ffi.typeinfo +local enuminfo = {} + +---@return ffi.constantinfo[] +function enuminfo:values() +end + +---@return ffi.constantinfo +function enuminfo:value(name_or_index) +end + +---@class ffi.funcinfo : ffi.typeinfo +---@field name string? +---@field sym_name string? +---@field return_type ffi.funcinfo +---@field nargs integer +---@field vararg boolean +---@field sse_reg_params boolean +---@field convention "cdecl"|"thiscall"|"fastcall"|"stdcall" +local funcinfo = {} + +---@return ffi.fieldinfo[] +function funcinfo:arguments() +end + +---@return ffi.fieldinfo +function funcinfo:argument(name_or_index) +end + +---@class ffi.unioninfo : ffi.typeinfo +---@field name string? +---@field size integer +---@field alignment number +---@field const boolean +---@field volatile boolean +---@field transparent boolean +local unioninfo = {} + +---@return ffi.typeinfo[] +function unioninfo:members() +end + +---@return ffi.typeinfo +function unioninfo:member(name_or_index) +end + +---@class ffi.structinfo : ffi.unioninfo +---@field vla boolean + +---@class ffi.floatinfo : ffi.typeinfo +---@field size integer +---@field alignment number +---@field const boolean +---@field volatile boolean + +---@alias ffi.voidinfo ffi.floatinfo + +---@class ffi.intinfo : ffi.floatinfo +---@field bool boolean +---@field unsigned boolean +---@field long boolean + +---@class ffi.constantinfo : ffi.typeinfo +---@field name string? +---@field type ffi.typeinfo +---@field value integer + +---@class ffi.ptrinfo : ffi.typeinfo +---@field size integer +---@field alignment number +---@field const boolean +---@field volatile boolean +---@field element_type ffi.typeinfo + +---@alias ffi.refinfo ffi.ptrinfo + +---@class ffi.arrayinfo : ffi.ptrinfo +---@field vla boolean +---@field vector boolean +---@field complex boolean + +---@class ffi.fieldinfo : ffi.typeinfo +---@field name string? +---@field offset number +---@field type ffi.typeinfo + +---@class ffi.bitfield : ffi.fieldinfo +---@field size integer|string + +local reflect = {} + +---reflection cdata c defined +---@param v ffi.cdata* +---@return ffi.typeinfo +function reflect.typeof(v) +end + +---try get cdata metatable +---@param v ffi.cdata* +---@return table +function reflect.getmetatable(v) +end + +return reflect
\ No newline at end of file diff --git a/meta/3rd/love2d/library/love/event.lua b/meta/3rd/love2d/library/love/event.lua index e06e3ae8..0b61f250 100644 --- a/meta/3rd/love2d/library/love/event.lua +++ b/meta/3rd/love2d/library/love/event.lua @@ -66,7 +66,7 @@ function love.event.push(n, a, b, c, d, e, f, ...) end --- ---[Open in Browser](https://love2d.org/wiki/love.event.quit) --- ----@overload fun('restart': string|'restart') +---@overload fun(restart: string|'restart') ---@param exitstatus? number # The program exit status to use when closing the application. function love.event.quit(exitstatus) end diff --git a/meta/3rd/love2d/library/love/math.lua b/meta/3rd/love2d/library/love/math.lua index b0e5516e..e8397cb5 100644 --- a/meta/3rd/love2d/library/love/math.lua +++ b/meta/3rd/love2d/library/love/math.lua @@ -532,6 +532,19 @@ function Transform:clone() end --- ---@return number e1_1 # The first column of the first row of the matrix. ---@return number e1_2 # The second column of the first row of the matrix. +---@return number e1_3 # The third column of the first row of the matrix. +---@return number e1_4 # The fourth column of the first row of the matrix. +---@return number e2_1 # The first column of the second row of the matrix. +---@return number e2_2 # The second column of the second row of the matrix. +---@return number e2_3 # The third column of the second row of the matrix. +---@return number e2_4 # The fourth column of the second row of the matrix. +---@return number e3_1 # The first column of the third row of the matrix. +---@return number e3_2 # The second column of the third row of the matrix. +---@return number e3_3 # The third column of the third row of the matrix. +---@return number e3_4 # The fourth column of the third row of the matrix. +---@return number e4_1 # The first column of the fourth row of the matrix. +---@return number e4_2 # The second column of the fourth row of the matrix. +---@return number e4_3 # The third column of the fourth row of the matrix. ---@return number e4_4 # The fourth column of the fourth row of the matrix. function Transform:getMatrix() end @@ -605,15 +618,27 @@ function Transform:scale(sx, sy) end --- ---[Open in Browser](https://love2d.org/wiki/Transform:setMatrix) --- ----@overload fun(self: love.Transform, layout: love.MatrixLayout, e1_1: number, e1_2: number, ..., e4_4: number):love.Transform +---@overload fun(self: love.Transform, layout: love.MatrixLayout, e1_1: number, e1_2: number, e1_3: number, e1_4: number, e2_1: number, e2_2: number, e2_3: number, e2_4: number, e3_1: number, e3_2: number, e3_3: number, e3_4: number, e4_1: number, e4_2: number, e4_3: number, e4_4: number):love.Transform ---@overload fun(self: love.Transform, layout: love.MatrixLayout, matrix: table):love.Transform ---@overload fun(self: love.Transform, layout: love.MatrixLayout, matrix: table):love.Transform ---@param e1_1 number # The first column of the first row of the matrix. ---@param e1_2 number # The second column of the first row of the matrix. ----@vararg number # Additional matrix elements. +---@param e1_3 number # The third column of the first row of the matrix. +---@param e1_4 number # The fourth column of the first row of the matrix. +---@param e2_1 number # The first column of the second row of the matrix. +---@param e2_2 number # The second column of the second row of the matrix. +---@param e2_3 number # The third column of the second row of the matrix. +---@param e2_4 number # The fourth column of the second row of the matrix. +---@param e3_1 number # The first column of the third row of the matrix. +---@param e3_2 number # The second column of the third row of the matrix. +---@param e3_3 number # The third column of the third row of the matrix. +---@param e3_4 number # The fourth column of the third row of the matrix. +---@param e4_1 number # The first column of the fourth row of the matrix. +---@param e4_2 number # The second column of the fourth row of the matrix. +---@param e4_3 number # The third column of the fourth row of the matrix. ---@param e4_4 number # The fourth column of the fourth row of the matrix. ---@return love.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods. -function Transform:setMatrix(e1_1, e1_2, ..., e4_4) end +function Transform:setMatrix(e1_1, e1_2, e1_3, e1_4, e2_1, e2_2, e2_3, e2_4, e3_1, e3_2, e3_3, e3_4, e4_1, e4_2, e4_3, e4_4) end --- ---Resets the Transform to the specified transformation parameters. diff --git a/meta/3rd/lovr/library/lovr/filesystem.lua b/meta/3rd/lovr/library/lovr/filesystem.lua index cbac0b29..c2a1220b 100644 --- a/meta/3rd/lovr/library/lovr/filesystem.lua +++ b/meta/3rd/lovr/library/lovr/filesystem.lua @@ -3,9 +3,7 @@ --- ---The `lovr.filesystem` module provides access to the filesystem. --- ---- ----### NOTE: ----LÖVR programs can only write to a single directory, called the save directory. +---All files written will go in a special folder called the "save directory". --- ---The location of the save directory is platform-specific: --- @@ -27,15 +25,25 @@ --- <td><code>/sdcard/Android/data/<identity>/files</code></td> --- </tr> </table> --- ----`<identity>` should be a unique identifier for your app. +---`<identity>` is a unique identifier for the project, and can be set in `lovr.conf`. +--- +---On Android, the identity can not be changed and will always be the package id (e.g. `org.lovr.app`). +--- +---When files are read, they will be searched for in multiple places. +--- +---By default, the save directory is checked first, then the project source (folder or zip). +--- +---That way, when data is written to a file, any future reads will see the new data. --- ----It can be set either in `lovr.conf` or by using `lovr.filesystem.setIdentity`. +---The `t.saveprecedence` conf setting can be used to change this precedence. --- ----On Android, the identity can not be changed and will always be the package id, like `org.lovr.app`. +---Conceptually, `lovr.filesystem` uses a "virtual filesystem", which is an ordered list of folders and zip files that are merged into a single filesystem hierarchy. --- ----All filenames are relative to either the save directory or the directory containing the project source. +---Folders and archives in the list can be added and removed with `lovr.filesystem.mount` and `lovr.filesystem.unmount`. --- ----Files in the save directory take precedence over files in the project. +---LÖVR extends Lua's `require` function to look for modules in the virtual filesystem. +--- +---The search patterns can be changed with `lovr.filesystem.setRequirePath`, similar to `package.path`. --- ---@class lovr.filesystem lovr.filesystem = {} @@ -269,7 +277,11 @@ function lovr.filesystem.remove(path) end --- ---Set the name of the save directory. --- ----@param identity string # The new name of the save directory. +---This function can only be called once and is called automatically at startup, so this function normally isn't called manually. +--- +---However, the identity can be changed by setting the `t.identity` option in `lovr.conf`. +--- +---@param identity string # The name of the save directory. function lovr.filesystem.setIdentity(identity) end --- @@ -279,7 +291,7 @@ function lovr.filesystem.setIdentity(identity) end --- ---Any question marks in the pattern will be replaced with the module that is being required. --- ----It is similar to Lua\'s `package.path` variable, but the main difference is that the patterns are relative to the save directory and the project directory. +---It is similar to Lua\'s `package.path` variable, except the patterns will be checked using `lovr.filesystem` APIs. This allows `require` to work even when the project is packaged into a zip archive, or when the project is launched from a different directory. --- --- ---### NOTE: @@ -302,7 +314,7 @@ function lovr.filesystem.setRequirePath(path) end function lovr.filesystem.unmount(path) end --- ----Write to a file. +---Write to a file in the save directory. --- --- ---### NOTE: @@ -310,6 +322,10 @@ function lovr.filesystem.unmount(path) end --- ---If the file already has data in it, it will be replaced with the new content. --- +---If the path contains subdirectories, all of the parent directories need to exist first or the write will fail. +--- +---Use `lovr.filesystem.createDirectory` to make sure they're created first. +--- ---@overload fun(filename: string, blob: lovr.Blob):boolean ---@param filename string # The file to write to. ---@param content string # A string to write to the file. diff --git a/meta/3rd/lovr/library/lovr/graphics.lua b/meta/3rd/lovr/library/lovr/graphics.lua index 36045f00..8157bdb2 100644 --- a/meta/3rd/lovr/library/lovr/graphics.lua +++ b/meta/3rd/lovr/library/lovr/graphics.lua @@ -526,8 +526,8 @@ function lovr.graphics.newTally(type, count, views) end ---### NOTE: ---If no `type` is provided in the options table, LÖVR will guess the `TextureType` of the Texture based on the number of layers: --- ----- If there's 1 layer, the type will be `2d`. ----- If there are 6 layers, the type will be `cube`. +---- If there's only 1 layer, the type will be `2d`. +---- If there are 6 images provided, the type will be `cube`. ---- Otherwise, the type will be `array`. --- ---Note that an Image can contain multiple layers and mipmaps. @@ -1534,7 +1534,9 @@ function Pass:capsule(transform, segments) end --- --- ---### NOTE: ----The local origin of the circle is in its center, and the local z axis goes through the center. +---The local origin of the circle is in its center. +--- +---The local z axis is perpendicular to plane of the circle. --- ---@param transform lovr.Mat4 # The transform of the circle. Can also be provided as position, radius, and rotation, using a mix of `Vectors` or numbers. ---@param style? lovr.DrawStyle # Whether the circle should be filled or outlined. @@ -1987,6 +1989,7 @@ function Pass:setAlphaToCoverage(enable) end ---### NOTE: ---The default blend mode is `alpha` with the `alphamultiply` alpha mode. --- +---@overload fun(self: lovr.Pass) ---@param blend lovr.BlendMode # The blend mode. ---@param alphaBlend lovr.BlendAlphaMode # The alpha blend mode, used to control premultiplied alpha. function Pass:setBlendMode(blend, alphaBlend) end diff --git a/meta/3rd/lovr/library/lovr/headset.lua b/meta/3rd/lovr/library/lovr/headset.lua index 0c26709e..8a7372c2 100644 --- a/meta/3rd/lovr/library/lovr/headset.lua +++ b/meta/3rd/lovr/library/lovr/headset.lua @@ -612,12 +612,26 @@ function lovr.headset.wasReleased(device, button) end --- ---Different types of input devices supported by the `lovr.headset` module. --- +--- +---### NOTE: +---The difference between `hand/left` and `hand/left/point` is the first represents an object held in the hand, whereas the second represents the laser pointer used to aim. +--- +---Drawing a controller model would use `hand/left`, whereas drawing a pointer or aiming would use `hand/left/point`. +--- ---@alias lovr.Device --- ---The headset. --- ---| "head" --- +---A shorthand for hand/left. +--- +---| "left" +--- +---A shorthand for hand/right. +--- +---| "right" +--- ---The left controller. --- ---| "hand/left" @@ -626,13 +640,13 @@ function lovr.headset.wasReleased(device, button) end --- ---| "hand/right" --- ----A shorthand for hand/left. +---The left controller pointer (pose only). --- ----| "left" +---| "hand/left/point" --- ----A shorthand for hand/right. +---The right controller pointer (pose only). --- ----| "right" +---| "hand/right/point" --- ---A device tracking the left elbow. --- diff --git a/meta/3rd/lovr/library/lovr/math.lua b/meta/3rd/lovr/library/lovr/math.lua index 907f4850..1b3a401d 100644 --- a/meta/3rd/lovr/library/lovr/math.lua +++ b/meta/3rd/lovr/library/lovr/math.lua @@ -528,7 +528,7 @@ function Mat4:transpose() end --- ---Returns the components of matrix, either as 10 separated numbers representing the position, scale, and rotation, or as 16 raw numbers representing the individual components of the matrix in column-major order. --- ----@param raw boolean # Whether to return the 16 raw components. +---@param raw? boolean # Whether to return the 16 raw components. function Mat4:unpack(raw) end --- diff --git a/meta/spell/lua_dict.txt b/meta/spell/lua_dict.txt index 29f5522a..59b35a8c 100644 --- a/meta/spell/lua_dict.txt +++ b/meta/spell/lua_dict.txt @@ -219,6 +219,12 @@ formatter env math suc -utf -ansi - +const +param +params +func +funcs +enum +enums +substring +globals diff --git a/meta/template/basic.lua b/meta/template/basic.lua index f3ebae94..c024b222 100644 --- a/meta/template/basic.lua +++ b/meta/template/basic.lua @@ -13,18 +13,18 @@ arg = {} function assert(v, message, ...) end ---@alias gcoptions ----|>'"collect"' # ---#DESTAIL 'cgopt.collect' ----| '"stop"' # ---#DESTAIL 'cgopt.stop' ----| '"restart"' # ---#DESTAIL 'cgopt.restart' ----| '"count"' # ---#DESTAIL 'cgopt.count' ----| '"step"' # ---#DESTAIL 'cgopt.step' ----| '"isrunning"' # ---#DESTAIL 'cgopt.isrunning' +---|>"collect" # ---#DESTAIL 'cgopt.collect' +---| "stop" # ---#DESTAIL 'cgopt.stop' +---| "restart" # ---#DESTAIL 'cgopt.restart' +---| "count" # ---#DESTAIL 'cgopt.count' +---| "step" # ---#DESTAIL 'cgopt.step' +---| "isrunning" # ---#DESTAIL 'cgopt.isrunning' ---#if VERSION >= 5.4 then ----| '"incremental"' # ---#DESTAIL 'cgopt.incremental' ----| '"generational"' # ---#DESTAIL 'cgopt.generational' +---| "incremental" # ---#DESTAIL 'cgopt.incremental' +---| "generational" # ---#DESTAIL 'cgopt.generational' ---#else ----| '"setpause"' # ---#DESTAIL 'cgopt.setpause' ----| '"setstepmul"' # ---#DESTAIL 'cgopt.setstepmul' +---| "setpause" # ---#DESTAIL 'cgopt.setpause' +---| "setstepmul" # ---#DESTAIL 'cgopt.setstepmul' ---#end ---#if VERSION >= 5.4 then @@ -76,9 +76,9 @@ function getmetatable(object) end function ipairs(t) end ---@alias loadmode ----| '"b"' # ---#DESTAIL 'loadmode.b' ----| '"t"' # ---#DESTAIL 'loadmode.t' ----|>'"bt"' # ---#DESTAIL 'loadmode.bt' +---| "b" # ---#DESTAIL 'loadmode.b' +---| "t" # ---#DESTAIL 'loadmode.t' +---|>"bt" # ---#DESTAIL 'loadmode.bt' ---#if VERSION <= 5.1 and not JIT then ---#DES 'load<5.1' @@ -128,7 +128,7 @@ function loadfile(filename, mode, env) end function loadstring(text, chunkname) end ---@version 5.1 ----@param proxy boolean|table +---@param proxy boolean|table|userdata ---@return userdata ---@nodiscard function newproxy(proxy) end @@ -197,7 +197,7 @@ function rawlen(v) end function rawset(table, index, value) end ---#DES 'select' ----@param index integer|'"#"' +---@param index integer|"#" ---@return any ---@nodiscard function select(index, ...) end @@ -229,16 +229,16 @@ function tonumber(e) end function tostring(v) end ---@alias type ----| '"nil"' ----| '"number"' ----| '"string"' ----| '"boolean"' ----| '"table"' ----| '"function"' ----| '"thread"' ----| '"userdata"' +---| "nil" +---| "number" +---| "string" +---| "boolean" +---| "table" +---| "function" +---| "thread" +---| "userdata" ---#if VERSION == JIT then ----| '"cdata"' +---| "cdata" ---#end ---#DES 'type' @@ -249,13 +249,13 @@ function type(v) end ---#DES '_VERSION' ---#if VERSION == 5.1 then -_VERSION = 'Lua 5.1' +_VERSION = "Lua 5.1" ---#elseif VERSION == 5.2 then -_VERSION = 'Lua 5.2' +_VERSION = "Lua 5.2" ---#elseif VERSION == 5.3 then -_VERSION = 'Lua 5.3' +_VERSION = "Lua 5.3" ---#elseif VERSION == 5.4 then -_VERSION = 'Lua 5.4' +_VERSION = "Lua 5.4" ---#end ---@version >5.4 diff --git a/meta/template/debug.lua b/meta/template/debug.lua index e7ac5911..9f48ee98 100644 --- a/meta/template/debug.lua +++ b/meta/template/debug.lua @@ -45,20 +45,20 @@ function debug.getfenv(o) end function debug.gethook(co) end ---@alias infowhat string ----|+'"n"' # ---#DESTAIL 'infowhat.n' ----|+'"S"' # ---#DESTAIL 'infowhat.S' ----|+'"l"' # ---#DESTAIL 'infowhat.l' ----|+'"t"' # ---#DESTAIL 'infowhat.t' +---|+"n" # ---#DESTAIL 'infowhat.n' +---|+"S" # ---#DESTAIL 'infowhat.S' +---|+"l" # ---#DESTAIL 'infowhat.l' +---|+"t" # ---#DESTAIL 'infowhat.t' ---#if VERSION <= 5.1 and not JIT then ----|+'"u"' # ---#DESTAIL 'infowhat.u<5.1' +---|+"u" # ---#DESTAIL 'infowhat.u<5.1' ---#else ----|+'"u"' # ---#DESTAIL 'infowhat.u>5.2' +---|+"u" # ---#DESTAIL 'infowhat.u>5.2' ---#end ----|+'"f"' # ---#DESTAIL 'infowhat.f' +---|+"f" # ---#DESTAIL 'infowhat.f' ---#if VERSION >= 5.4 then ----|+'"r"' # ---#DESTAIL 'infowhat.r' +---|+"r" # ---#DESTAIL 'infowhat.r' ---#end ----|+'"L"' # ---#DESTAIL 'infowhat.L' +---|+"L" # ---#DESTAIL 'infowhat.L' ---#DES 'debug.getinfo' ---@overload fun(f: integer|function, what?: infowhat):debuginfo @@ -141,9 +141,9 @@ function debug.setcstacklimit(limit) end function debug.setfenv(object, env) end ---@alias hookmask string ----|+'"c"' # ---#DESTAIL 'hookmask.c' ----|+'"r"' # ---#DESTAIL 'hookmask.r' ----|+'"l"' # ---#DESTAIL 'hookmask.l' +---|+"c" # ---#DESTAIL 'hookmask.c' +---|+"r" # ---#DESTAIL 'hookmask.r' +---|+"l" # ---#DESTAIL 'hookmask.l' ---#DES 'debug.sethook' ---@overload fun(hook: (async fun(...):...), mask: hookmask, count?: integer) diff --git a/meta/template/io.lua b/meta/template/io.lua index a3420479..2200a626 100644 --- a/meta/template/io.lua +++ b/meta/template/io.lua @@ -11,18 +11,18 @@ io = {} ---@alias openmode ----|>'"r"' # ---#DESTAIL 'openmode.r' ----| '"w"' # ---#DESTAIL 'openmode.w' ----| '"a"' # ---#DESTAIL 'openmode.a' ----| '"r+"' # ---#DESTAIL 'openmode.r+' ----| '"w+"' # ---#DESTAIL 'openmode.w+' ----| '"a+"' # ---#DESTAIL 'openmode.a+' ----| '"rb"' # ---#DESTAIL 'openmode.rb' ----| '"wb"' # ---#DESTAIL 'openmode.wb' ----| '"ab"' # ---#DESTAIL 'openmode.ab' ----| '"r+b"' # ---#DESTAIL 'openmode.r+b' ----| '"w+b"' # ---#DESTAIL 'openmode.w+b' ----| '"a+b"' # ---#DESTAIL 'openmode.a+b' +---|>"r" # ---#DESTAIL 'openmode.r' +---| "w" # ---#DESTAIL 'openmode.w' +---| "a" # ---#DESTAIL 'openmode.a' +---| "r+" # ---#DESTAIL 'openmode.r+' +---| "w+" # ---#DESTAIL 'openmode.w+' +---| "a+" # ---#DESTAIL 'openmode.a+' +---| "rb" # ---#DESTAIL 'openmode.rb' +---| "wb" # ---#DESTAIL 'openmode.wb' +---| "ab" # ---#DESTAIL 'openmode.ab' +---| "r+b" # ---#DESTAIL 'openmode.r+b' +---| "w+b" # ---#DESTAIL 'openmode.w+b' +---| "a+b" # ---#DESTAIL 'openmode.a+b' ---#DES 'io.close' ---@param file? file* @@ -59,8 +59,8 @@ function io.open(filename, mode) end function io.output(file) end ---@alias popenmode ----| '"r"' # ---#DESTAIL 'popenmode.r' ----| '"w"' # ---#DESTAIL 'popenmode.w' +---| "r" # ---#DESTAIL 'popenmode.r' +---| "w" # ---#DESTAIL 'popenmode.w' ---#DES 'io.popen' ---@param prog string @@ -82,9 +82,9 @@ function io.read(...) end function io.tmpfile() end ---@alias filetype ----| '"file"' # ---#DESTAIL 'filetype.file' ----| '"closed file"' # ---#DESTAIL 'filetype.closed file' ----| 'nil' # ---#DESTAIL 'filetype.nil' +---| "file" # ---#DESTAIL 'filetype.file' +---| "closed file" # ---#DESTAIL 'filetype.closed file' +---| `nil` # ---#DESTAIL 'filetype.nil' ---#DES 'io.type' ---@param file file* @@ -103,20 +103,20 @@ local file = {} ---@alias readmode integer|string ---#if VERSION >= 5.3 then ----| '"n"' # ---#DESTAIL 'readmode.n' ----| '"a"' # ---#DESTAIL 'readmode.a' ----|>'"l"' # ---#DESTAIL 'readmode.l' ----| '"L"' # ---#DESTAIL 'readmode.L' +---| "n" # ---#DESTAIL 'readmode.n' +---| "a" # ---#DESTAIL 'readmode.a' +---|>"l" # ---#DESTAIL 'readmode.l' +---| "L" # ---#DESTAIL 'readmode.L' ---#else ----| '"*n"' # ---#DESTAIL 'readmode.n' ----| '"*a"' # ---#DESTAIL 'readmode.a' ----|>'"*l"' # ---#DESTAIL 'readmode.l' +---| "*n" # ---#DESTAIL 'readmode.n' +---| "*a" # ---#DESTAIL 'readmode.a' +---|>"*l" # ---#DESTAIL 'readmode.l' ---#if JIT then ----| '"*L"' # ---#DESTAIL 'readmode.L' +---| "*L" # ---#DESTAIL 'readmode.L' ---#end ---#end ----@alias exitcode '"exit"'|'"signal"' +---@alias exitcode "exit"|"signal" ---#DES 'file:close' ---@return boolean? suc @@ -140,9 +140,9 @@ function file:lines(...) end function file:read(...) end ---@alias seekwhence ----| '"set"' # ---#DESTAIL 'seekwhence.set' ----|>'"cur"' # ---#DESTAIL 'seekwhence.cur' ----| '"end"' # ---#DESTAIL 'seekwhence.end' +---| "set" # ---#DESTAIL 'seekwhence.set' +---|>"cur" # ---#DESTAIL 'seekwhence.cur' +---| "end" # ---#DESTAIL 'seekwhence.end' ---#DES 'file:seek' ---@param whence? seekwhence @@ -152,9 +152,9 @@ function file:read(...) end function file:seek(whence, offset) end ---@alias vbuf ----| '"no"' # ---#DESTAIL 'vbuf.no' ----| '"full"' # ---#DESTAIL 'vbuf.full' ----| '"line"' # ---#DESTAIL 'vbuf.line' +---| "no" # ---#DESTAIL 'vbuf.no' +---| "full" # ---#DESTAIL 'vbuf.full' +---| "line" # ---#DESTAIL 'vbuf.line' ---#DES 'file:setvbuf' ---@param mode vbuf diff --git a/meta/template/math.lua b/meta/template/math.lua index 07917a2b..37e1d5c7 100644 --- a/meta/template/math.lua +++ b/meta/template/math.lua @@ -15,8 +15,9 @@ math = {} ---#DES 'math.abs' ----@param x number ----@return number +---@generic Number: number +---@param x Number +---@return Number ---@nodiscard function math.abs(x) end diff --git a/meta/template/os.lua b/meta/template/os.lua index fbc56ac1..102a9228 100644 --- a/meta/template/os.lua +++ b/meta/template/os.lua @@ -87,12 +87,12 @@ function os.remove(filename) end function os.rename(oldname, newname) end ---@alias localecategory ----|>'"all"' ----| '"collate"' ----| '"ctype"' ----| '"monetary"' ----| '"numeric"' ----| '"time"' +---|>"all" +---| "collate" +---| "ctype" +---| "monetary" +---| "numeric" +---| "time" ---#DES 'os.setlocale' ---@param locale string|nil diff --git a/meta/template/string.lua b/meta/template/string.lua index cf83104b..841654f5 100644 --- a/meta/template/string.lua +++ b/meta/template/string.lua @@ -5,7 +5,7 @@ string = {} ---#DES 'string.byte' ----@param s string +---@param s string|number ---@param i? integer ---@param j? integer ---@return integer ... @@ -27,8 +27,8 @@ function string.char(byte, ...) end function string.dump(f, strip) end ---#DES 'string.find' ----@param s string ----@param pattern string +---@param s string|number +---@param pattern string|number ---@param init? integer ---@param plain? boolean ---@return integer start @@ -38,7 +38,7 @@ function string.dump(f, strip) end function string.find(s, pattern, init, plain) end ---#DES 'string.format' ----@param s any +---@param s string|number ---@param ... any ---@return string ---@nodiscard @@ -46,22 +46,22 @@ function string.format(s, ...) end ---#DES 'string.gmatch' ---#if VERSION <= 5.3 then ----@param s string ----@param pattern string +---@param s string|number +---@param pattern string|number ---@return fun():string, ... ---@nodiscard function string.gmatch(s, pattern) end ---#else ----@param s string ----@param pattern string +---@param s string|number +---@param pattern string|number ---@param init? integer ---@return fun():string, ... function string.gmatch(s, pattern, init) end ---#end ---#DES 'string.gsub' ----@param s string ----@param pattern string +---@param s string|number +---@param pattern string|number ---@param repl string|number|table|function ---@param n? integer ---@return string @@ -70,20 +70,20 @@ function string.gmatch(s, pattern, init) end function string.gsub(s, pattern, repl, n) end ---#DES 'string.len' ----@param s string +---@param s string|number ---@return integer ---@nodiscard function string.len(s) end ---#DES 'string.lower' ----@param s string +---@param s string|number ---@return string ---@nodiscard function string.lower(s) end ---#DES 'string.match' ----@param s string ----@param pattern string +---@param s string|number +---@param pattern string|number ---@param init? integer ---@return any ... ---@nodiscard @@ -107,29 +107,29 @@ function string.packsize(fmt) end ---#if VERSION <= 5.1 and not JIT then ---#DES 'string.rep<5.1' ----@param s string +---@param s string|number ---@param n integer ---@return string ---@nodiscard function string.rep(s, n) end ---#else ---#DES 'string.rep>5.2' ----@param s string +---@param s string|number ---@param n integer ----@param sep? string +---@param sep? string|number ---@return string ---@nodiscard function string.rep(s, n, sep) end ---#end ---#DES 'string.reverse' ----@param s string +---@param s string|number ---@return string ---@nodiscard function string.reverse(s) end ---#DES 'string.sub' ----@param s string +---@param s string|number ---@param i integer ---@param j? integer ---@return string @@ -147,7 +147,7 @@ function string.sub(s, i, j) end function string.unpack(fmt, s, pos) end ---#DES 'string.upper' ----@param s string +---@param s string|number ---@return string ---@nodiscard function string.upper(s) end diff --git a/meta/template/table.lua b/meta/template/table.lua index 40ba0ac1..a2e9580b 100644 --- a/meta/template/table.lua +++ b/meta/template/table.lua @@ -37,7 +37,7 @@ function table.maxn(table) end ---@return table a2 function table.move(a1, f, e, t, a2) end ----@version >5.2 +---@version >5.2, JIT ---#DES 'table.pack' ---@return table ---@nodiscard @@ -55,7 +55,7 @@ function table.remove(list, pos) end ---@param comp? fun(a: T, b: T):boolean function table.sort(list, comp) end ----@version >5.2 +---@version >5.2, JIT ---#DES 'table.unpack' ---@generic T ---@param list T[] diff --git a/script/cli/check.lua b/script/cli/check.lua index 37b6ad15..ea767fae 100644 --- a/script/cli/check.lua +++ b/script/cli/check.lua @@ -8,6 +8,9 @@ local jsonb = require 'json-beautify' local lang = require 'language' local define = require 'proto.define' local config = require 'config.config' +local fs = require 'bee.filesystem' + +require 'vm' lang(LOCALE) @@ -16,9 +19,10 @@ if type(CHECK) ~= 'string' then return end -local rootUri = furi.encode(CHECK) +local rootPath = fs.absolute(fs.path(CHECK)):string() +local rootUri = furi.encode(rootPath) if not rootUri then - print(lang.script('CLI_CHECK_ERROR_URI', CHECK)) + print(lang.script('CLI_CHECK_ERROR_URI', rootPath)) return end diff --git a/script/cli/doc.lua b/script/cli/doc.lua index e0d7be5e..f94a2066 100644 --- a/script/cli/doc.lua +++ b/script/cli/doc.lua @@ -12,24 +12,11 @@ local vm = require 'vm' local guide = require 'parser.guide' local getDesc = require 'core.hover.description' local getLabel = require 'core.hover.label' +local doc2md = require 'cli.doc2md' +local progress = require 'progress' +local fs = require 'bee.filesystem' -lang(LOCALE) - -if type(DOC) ~= 'string' then - print(lang.script('CLI_CHECK_ERROR_TYPE', type(DOC))) - return -end - -local rootUri = furi.encode(DOC) -if not rootUri then - print(lang.script('CLI_CHECK_ERROR_URI', DOC)) - return -end - -util.enableCloseFunction() - -local lastClock = os.clock() -local results = {} +local export = {} ---@async local function packObject(source, mark) @@ -89,7 +76,7 @@ local function packObject(source, mark) if source.bindDocs then new['desc'] = getDesc(source) end - new['view'] = new['view'] or vm.getInfer(source):view(rootUri) + new['view'] = new['view'] or vm.getInfer(source):view(ws.rootUri) end return new end @@ -112,17 +99,19 @@ end ---@async ---@param global vm.global -local function collect(global) +---@param results table +local function collectTypes(global, results) if guide.isBasicType(global.name) then return end local result = { name = global.name, + type = 'type', desc = nil, defines = {}, fields = {}, } - for _, set in ipairs(global:getSets(rootUri)) do + for _, set in ipairs(global:getSets(ws.rootUri)) do local uri = guide.getUri(set) if files.isLibrary(uri) then goto CONTINUE @@ -149,7 +138,7 @@ local function collect(global) results[#results+1] = result ---@async ---@diagnostic disable-next-line: not-yieldable - vm.getClassFields(rootUri, global, vm.ANY, function (source) + vm.getClassFields(ws.rootUri, global, vm.ANY, function (source) if source.type == 'doc.field' then ---@cast source parser.object if files.isLibrary(guide.getUri(source)) then @@ -160,7 +149,7 @@ local function collect(global) if source.field.type == 'doc.field.name' then field.name = source.field[1] else - field.name = ('[%s]'):format(vm.getInfer(source.field):view(rootUri)) + field.name = ('[%s]'):format(vm.getInfer(source.field):view(ws.rootUri)) end field.type = source.type field.file = guide.getUri(source) @@ -219,46 +208,153 @@ local function collect(global) end ---@async -lclient():start(function (client) - client:registerFakers() - - client:initialize { - rootUri = rootUri, +---@param global vm.global +---@param results table +local function collectVars(global, results) + local result = { + name = global:getCodeName(), + type = 'variable', + desc = nil, + defines = {}, } + for _, set in ipairs(global:getSets(ws.rootUri)) do + if set.type == 'setglobal' + or set.type == 'setfield' + or set.type == 'setmethod' + or set.type == 'setindex' then + result.defines[#result.defines+1] = { + type = set.type, + file = guide.getUri(set), + start = set.start, + finish = set.finish, + extends = packObject(set.value), + } + result.desc = result.desc or getDesc(set) + end + end + if #result.defines == 0 then + return + end + table.sort(result.defines, function (a, b) + if a.file ~= b.file then + return a.file < b.file + end + return a.start < b.start + end) + results[#results+1] = result +end - io.write(lang.script('CLI_DOC_INITING')) - - config.set(nil, 'Lua.diagnostics.enable', false) - config.set(nil, 'Lua.hover.expandAlias', false) - - ws.awaitReady(rootUri) - await.sleep(0.1) - - local globals = vm.getGlobals 'type' +---@async +---@param callback fun(i, max) +function export.export(outputPath, callback) + local results = {} + local globals = vm.getAllGlobals() - local max = #globals - for i, global in ipairs(globals) do - collect(global) - if os.clock() - lastClock > 0.2 then - lastClock = os.clock() - local output = '\x0D' - .. ('>'):rep(math.ceil(i / max * 20)) - .. ('='):rep(20 - math.ceil(i / max * 20)) - .. ' ' - .. ('0'):rep(#tostring(max) - #tostring(i)) - .. tostring(i) .. '/' .. tostring(max) - io.write(output) + local max = 0 + for _ in pairs(globals) do + max = max + 1 + end + local i = 0 + for _, global in pairs(globals) do + if global.cate == 'variable' then + collectVars(global, results) + elseif global.cate == 'type' then + collectTypes(global, results) end + i = i + 1 + callback(i, max) end - io.write('\x0D') table.sort(results, function (a, b) return a.name < b.name end) -end) -local outpath = LOGPATH .. '/doc.json' -jsonb.supportSparseArray = true -util.saveFile(outpath, jsonb.beautify(results)) + local docPath = outputPath .. '/doc.json' + jsonb.supportSparseArray = true + util.saveFile(docPath, jsonb.beautify(results)) + + local mdPath = doc2md.buildMD(outputPath) + return docPath, mdPath +end + +---@async +---@param outputPath string +function export.makeDoc(outputPath) + ws.awaitReady(ws.rootUri) + + local expandAlias = config.get(ws.rootUri, 'Lua.hover.expandAlias') + config.set(ws.rootUri, 'Lua.hover.expandAlias', false) + local _ <close> = function () + config.set(ws.rootUri, 'Lua.hover.expandAlias', expandAlias) + end + + await.sleep(0.1) + + local prog <close> = progress.create(ws.rootUri, '正在生成文档...', 0) + local docPath, mdPath = export.export(outputPath, function (i, max) + prog:setMessage(('%d/%d'):format(i, max)) + prog:setPercentage((i) / max * 100) + end) + + return docPath, mdPath +end + +function export.runCLI() + lang(LOCALE) + + if type(DOC) ~= 'string' then + print(lang.script('CLI_CHECK_ERROR_TYPE', type(DOC))) + return + end + + local rootUri = furi.encode(fs.absolute(fs.path(DOC)):string()) + if not rootUri then + print(lang.script('CLI_CHECK_ERROR_URI', DOC)) + return + end + + print('root uri = ' .. rootUri) + + util.enableCloseFunction() + + local lastClock = os.clock() + + ---@async + lclient():start(function (client) + client:registerFakers() + + client:initialize { + rootUri = rootUri, + } + + io.write(lang.script('CLI_DOC_INITING')) + + config.set(nil, 'Lua.diagnostics.enable', false) + config.set(nil, 'Lua.hover.expandAlias', false) + + ws.awaitReady(rootUri) + await.sleep(0.1) + + local docPath, mdPath = export.export(LOGPATH, function (i, max) + if os.clock() - lastClock > 0.2 then + lastClock = os.clock() + local output = '\x0D' + .. ('>'):rep(math.ceil(i / max * 20)) + .. ('='):rep(20 - math.ceil(i / max * 20)) + .. ' ' + .. ('0'):rep(#tostring(max) - #tostring(i)) + .. tostring(i) .. '/' .. tostring(max) + io.write(output) + end + end) + + io.write('\x0D') + + print(lang.script('CLI_DOC_DONE' + , ('[%s](%s)'):format(files.normalize(docPath), furi.encode(docPath)) + , ('[%s](%s)'):format(files.normalize(mdPath), furi.encode(mdPath)) + )) + end) +end -require 'cli.doc2md' +return export diff --git a/script/cli/doc2md.lua b/script/cli/doc2md.lua index 8c0956f1..70c1b2a0 100644 --- a/script/cli/doc2md.lua +++ b/script/cli/doc2md.lua @@ -5,29 +5,49 @@ local jsonc = require 'jsonc' local util = require 'utility' local markdown = require 'provider.markdown' -local doc = jsonc.decode_jsonc(util.loadFile(LOGPATH .. '/doc.json')) -local md = markdown() - -assert(type(doc) == 'table') - -for _, class in ipairs(doc) do - md:add('md', '# ' .. class.name) - md:emptyLine() - md:add('md', class.desc) - md:emptyLine() - local mark = {} - for _, field in ipairs(class.fields) do - if not mark[field.name] then - mark[field.name] = true - md:add('md', '## ' .. field.name) - md:emptyLine() - md:add('lua', field.extends.view) - md:emptyLine() - md:add('md', field.desc) - md:emptyLine() +local export = {} + +function export.buildMD(outputPath) + local doc = jsonc.decode_jsonc(util.loadFile(outputPath .. '/doc.json')) + local md = markdown() + + assert(type(doc) == 'table') + + for _, class in ipairs(doc) do + md:add('md', '# ' .. class.name) + md:emptyLine() + md:add('md', class.desc) + md:emptyLine() + if class.defines then + for _, define in ipairs(class.defines) do + if define.extends then + md:add('lua', define.extends.view) + md:emptyLine() + end + end + end + if class.fields then + local mark = {} + for _, field in ipairs(class.fields) do + if not mark[field.name] then + mark[field.name] = true + md:add('md', '## ' .. field.name) + md:emptyLine() + md:add('lua', field.extends.view) + md:emptyLine() + md:add('md', field.desc) + md:emptyLine() + end + end end + md:splitLine() end - md:splitLine() + + local mdPath = outputPath .. '/doc.md' + + util.saveFile(mdPath, md:string()) + + return mdPath end -util.saveFile(LOGPATH .. '/doc.md', md:string()) +return export diff --git a/script/cli/init.lua b/script/cli/init.lua index ad5cc3fe..b5a9f86d 100644 --- a/script/cli/init.lua +++ b/script/cli/init.lua @@ -9,6 +9,6 @@ if _G['CHECK'] then end if _G['DOC'] then - require 'cli.doc' + require 'cli.doc' .runCLI() os.exit(0, true) end diff --git a/script/client.lua b/script/client.lua index e702a78b..a8eda9b8 100644 --- a/script/client.lua +++ b/script/client.lua @@ -59,7 +59,7 @@ function m.getAbility(name) end current = current[parent] if not current then - return nil + return current end if nextPos > #name then break @@ -109,6 +109,7 @@ function m.showMessage(type, ...) type = define.MessageType[type] or 3, message = message, }) + log.info('ShowMessage', type, message) end ---@param type message.type @@ -128,11 +129,13 @@ function m.requestMessage(type, message, titles, callback) } map[title] = i end + log.info('requestMessage', type, message) proto.request('window/showMessageRequest', { type = define.MessageType[type] or 3, message = message, actions = actions, }, function (item) + log.info('responseMessage', message, item and item.title or nil) if item then callback(item.title, map[item.title]) else @@ -275,10 +278,11 @@ local function searchPatchInfo(cfg, rawKey) } end +---@param uri uri ---@param cfg table ---@param change config.change ---@return json.patch? -local function makeConfigPatch(cfg, change) +local function makeConfigPatch(uri, cfg, change) local info = searchPatchInfo(cfg, change.key) if change.action == 'add' then if type(info.value) == 'table' and #info.value > 0 then @@ -288,10 +292,10 @@ local function makeConfigPatch(cfg, change) value = change.value, } else - return makeConfigPatch(cfg, { + return makeConfigPatch(uri, cfg, { action = 'set', key = change.key, - value = { change.value }, + value = config.get(uri, change.key), }) end elseif change.action == 'set' then @@ -309,42 +313,44 @@ local function makeConfigPatch(cfg, change) } end elseif change.action == 'prop' then - if type(info.value) == 'table' and #info.value == 0 then + if type(info.value) == 'table' and next(info.value) then return { op = 'add', path = info.key .. '/' .. change.prop, value = change.value, } else - return makeConfigPatch(cfg, { + return makeConfigPatch(uri, cfg, { action = 'set', key = change.key, - value = { [change.prop] = change.value }, + value = config.get(uri, change.key), }) end end return nil end +---@param uri uri ---@param path string ---@param changes config.change[] ---@return string? -local function editConfigJson(path, changes) +local function editConfigJson(uri, path, changes) local text = util.loadFile(path) if not text then + m.showMessage('Error', lang.script('CONFIG_LOAD_FAILED', path)) return nil end local suc, res = pcall(jsonc.decode_jsonc, text) if not suc then m.showMessage('Error', lang.script('CONFIG_MODIFY_FAIL_SYNTAX_ERROR', path .. res:match 'ERROR(.+)$')) - return text + return nil end if type(res) ~= 'table' then res = {} end ---@cast res table for _, change in ipairs(changes) do - local patch = makeConfigPatch(res, change) + local patch = makeConfigPatch(uri, res, change) if patch then text = jsone.edit(text, patch, { indent = ' ' }) end @@ -352,28 +358,49 @@ local function editConfigJson(path, changes) return text end +---@param changes config.change[] +---@param applied config.change[] +local function removeAppliedChanges(changes, applied) + local appliedMap = {} + for _, change in ipairs(applied) do + appliedMap[change] = true + end + for i = #changes, 1, -1 do + if appliedMap[changes[i]] then + table.remove(changes, i) + end + end +end + local function tryModifySpecifiedConfig(uri, finalChanges) if #finalChanges == 0 then return false end + log.info('tryModifySpecifiedConfig', uri, inspect(finalChanges)) local workspace = require 'workspace' local scp = scope.getScope(uri) if scp:get('lastLocalType') ~= 'json' then + log.info('lastLocalType ~= json') return false end local validChanges = getValidChanges(uri, finalChanges) if #validChanges == 0 then + log.info('No valid changes') return false end local path = workspace.getAbsolutePath(uri, CONFIGPATH) if not path then + log.info('Can not get absolute path') return false end - local newJson = editConfigJson(path, validChanges) + local newJson = editConfigJson(uri, path, validChanges) if not newJson then + log.info('Can not edit config json') return false end util.saveFile(path, newJson) + log.info('Apply changes to config file', inspect(validChanges)) + removeAppliedChanges(finalChanges, validChanges) return true end @@ -381,28 +408,39 @@ local function tryModifyRC(uri, finalChanges, create) if #finalChanges == 0 then return false end + log.info('tryModifyRC', uri, inspect(finalChanges)) local workspace = require 'workspace' local path = workspace.getAbsolutePath(uri, '.luarc.jsonc') if not path then + log.info('Can not get absolute path of .luarc.jsonc') return false end path = fs.exists(fs.path(path)) and path or workspace.getAbsolutePath(uri, '.luarc.json') if not path then + log.info('Can not get absolute path of .luarc.json') return false end local buf = util.loadFile(path) if not buf and not create then + log.info('Can not load .luarc.json and not create') return false end local validChanges = getValidChanges(uri, finalChanges) if #validChanges == 0 then + log.info('No valid changes') return false end - local newJson = editConfigJson(path, validChanges) + if not buf then + util.saveFile(path, '') + end + local newJson = editConfigJson(uri, path, validChanges) if not newJson then + log.info('Can not edit config json') return false end util.saveFile(path, newJson) + log.info('Apply changes to .luarc.json', inspect(validChanges)) + removeAppliedChanges(finalChanges, validChanges) return true end @@ -410,6 +448,7 @@ local function tryModifyClient(uri, finalChanges) if #finalChanges == 0 then return false end + log.info('tryModifyClient', uri, inspect(finalChanges)) if not m.getOption 'changeConfiguration' then return false end @@ -422,12 +461,15 @@ local function tryModifyClient(uri, finalChanges) end end if #scpChanges == 0 then + log.info('No changes in client scope') return false end proto.notify('$/command', { command = 'lua.config', data = scpChanges, }) + log.info('Apply client changes', uri, inspect(scpChanges)) + removeAppliedChanges(finalChanges, scpChanges) return true end @@ -436,22 +478,43 @@ local function tryModifyClientGlobal(finalChanges) if #finalChanges == 0 then return end + log.info('tryModifyClientGlobal', inspect(finalChanges)) if not m.getOption 'changeConfiguration' then + log.info('Client dose not support modifying config') return end local changes = {} - for i = #finalChanges, 1, -1 do - local change = finalChanges[i] + for _, change in ipairs(finalChanges) do if change.global then changes[#changes+1] = change - finalChanges[i] = finalChanges[#finalChanges] - finalChanges[#finalChanges] = nil end end + if #changes == 0 then + log.info('No global changes') + return + end proto.notify('$/command', { command = 'lua.config', data = changes, }) + log.info('Apply client global changes', inspect(changes)) + removeAppliedChanges(finalChanges, changes) +end + +---@param changes config.change[] +---@return string +local function buildMaunuallyMessage(changes) + local message = {} + for _, change in ipairs(changes) do + if change.action == 'add' then + message[#message+1] = '* ' .. lang.script('WINDOW_MANUAL_CONFIG_ADD', change.key, change.value) + elseif change.action == 'set' then + message[#message+1] = '* ' .. lang.script('WINDOW_MANUAL_CONFIG_SET', change.key, change.value) + elseif change.action == 'prop' then + message[#message+1] = '* ' .. lang.script('WINDOW_MANUAL_CONFIG_PROP', change.key, change.prop, change.value) + end + end + return table.concat(message, '\n') end ---@param changes config.change[] @@ -482,28 +545,28 @@ function m.setConfig(changes, onlyMemory) if #finalChanges == 0 then return end + log.info('Modify config', inspect(finalChanges)) xpcall(function () local ws = require 'workspace' + tryModifyClientGlobal(finalChanges) if #ws.folders == 0 then - if tryModifySpecifiedConfig(nil, finalChanges) then - return - end + tryModifySpecifiedConfig(nil, finalChanges) tryModifyClient(nil, finalChanges) - return - end - tryModifyClientGlobal(finalChanges) - for _, scp in ipairs(ws.folders) do - if tryModifySpecifiedConfig(scp.uri, finalChanges) then - goto CONTINUE + if #finalChanges > 0 then + local manuallyModifyConfig = buildMaunuallyMessage(finalChanges) + m.showMessage('Warning', lang.script('CONFIG_MODIFY_FAIL_NO_WORKSPACE', manuallyModifyConfig)) end - if tryModifyRC(scp.uri, finalChanges, false) then - goto CONTINUE + else + for _, scp in ipairs(ws.folders) do + tryModifySpecifiedConfig(scp.uri, finalChanges) + tryModifyRC(scp.uri, finalChanges, false) + tryModifyClient(scp.uri, finalChanges) + tryModifyRC(scp.uri, finalChanges, true) end - if tryModifyClient(scp.uri, finalChanges) then - goto CONTINUE + if #finalChanges > 0 then + m.showMessage('Warning', lang.script('CONFIG_MODIFY_FAIL', buildMaunuallyMessage(finalChanges))) + log.warn('Config modify fail', inspect(finalChanges)) end - tryModifyRC(scp.uri, finalChanges, true) - ::CONTINUE:: end end, log.error) end @@ -591,7 +654,7 @@ local function hookPrint() end function m.init(t) - log.debug('Client init', inspect(t)) + log.info('Client init', inspect(t)) m.info = t nonil.enable() m.client(t.clientInfo.name) diff --git a/script/config/template.lua b/script/config/template.lua index 6d680ea0..3d2a8d35 100644 --- a/script/config/template.lua +++ b/script/config/template.lua @@ -210,6 +210,7 @@ local template = { 'assert', 'error', 'type', + 'os.exit', } ), ['Lua.runtime.meta'] = Type.String >> '${version} ${language} ${encoding}', @@ -318,7 +319,6 @@ local template = { ['Lua.workspace.library'] = Type.Array(Type.String), ['Lua.workspace.checkThirdParty'] = Type.Boolean >> true, ['Lua.workspace.userThirdParty'] = Type.Array(Type.String), - ['Lua.workspace.supportScheme'] = Type.Array(Type.String) >> { 'file', 'untitled', 'git' }, ['Lua.completion.enable'] = Type.Boolean >> true, ['Lua.completion.callSnippet'] = Type.String >> 'Disable' << { 'Disable', @@ -395,8 +395,17 @@ local template = { ['Lua.doc.packageName'] = Type.Array(Type.String), -- VSCode + ["Lua.addonManager.enable"] = Type.Boolean >> true, ['files.associations'] = Type.Hash(Type.String, Type.String), - ['files.exclude'] = Type.Hash(Type.String, Type.Boolean), + -- copy from VSCode default + ['files.exclude'] = Type.Hash(Type.String, Type.Boolean) >> { + ["**/.DS_Store"] = true, + ["**/.git"] = true, + ["**/.hg"] = true, + ["**/.svn"] = true, + ["**/CVS"] = true, + ["**/Thumbs.db"] = true, + }, ['editor.semanticHighlighting.enabled'] = Type.Or(Type.Boolean, Type.String), ['editor.acceptSuggestionOnEnter'] = Type.String >> 'on', } diff --git a/script/core/command/exportDocument.lua b/script/core/command/exportDocument.lua new file mode 100644 index 00000000..39832856 --- /dev/null +++ b/script/core/command/exportDocument.lua @@ -0,0 +1,16 @@ +local doc = require 'cli.doc' +local client = require 'client' +local furi = require 'file-uri' +local lang = require 'language' +local ws = require 'workspace' +local files = require 'files' + +---@async +return function (args) + local outputPath = args[1] and furi.decode(args[1]) or LOGPATH + local docPath, mdPath = doc.makeDoc(outputPath) + client.showMessage('Info', lang.script('CLI_DOC_DONE' + , ('[%s](%s)'):format(files.normalize(docPath), furi.encode(docPath)) + , ('[%s](%s)'):format(files.normalize(mdPath), furi.encode(mdPath)) + )) +end diff --git a/script/core/command/getConfig.lua b/script/core/command/getConfig.lua new file mode 100644 index 00000000..7a35c198 --- /dev/null +++ b/script/core/command/getConfig.lua @@ -0,0 +1,13 @@ +local config = require 'config' +local client = require 'client' +local await = require 'await' + +---@async +return function (data) + local uri = data[1].uri + local key = data[1].key + while not client:isReady() do + await.sleep(0.1) + end + return config.get(uri, key) +end diff --git a/script/core/command/setConfig.lua b/script/core/command/setConfig.lua index 4587dd47..af978ebe 100644 --- a/script/core/command/setConfig.lua +++ b/script/core/command/setConfig.lua @@ -1,5 +1,11 @@ local client = require 'client' +local await = require 'await' -return function (data) - client.setConfig { data } +---@async +---@param changes config.change[] +return function (changes) + while not client:isReady() do + await.sleep(0.1) + end + client.setConfig(changes) end diff --git a/script/core/completion/auto-require.lua b/script/core/completion/auto-require.lua index 74fd2e1e..3139b911 100644 --- a/script/core/completion/auto-require.lua +++ b/script/core/completion/auto-require.lua @@ -48,16 +48,24 @@ function m.check(state, word, position, callback) local infos = rpath.getVisiblePath(uri, path) local testedStem = { } for _, sr in ipairs(infos) do - local pattern = sr.searcher - :gsub("(%p)", "%%%1") - :gsub("%%%?", "(.-)") + local stemName + if sr.searcher == '[[meta]]' then + stemName = sr.name + else + local pattern = sr.searcher + : gsub("(%p)", "%%%1") + : gsub("%%%?", "(.-)") - local stemName = relativePath - :match(pattern) - :match("[%a_][%w_]*$") + local stemPath = relativePath:match(pattern) + if not stemPath then + goto INNER_CONTINUE + end + + stemName = stemPath:match("[%a_][%w_]*$") - if not stemName or testedStem[stemName] then - goto INNER_CONTINUE + if not stemName or testedStem[stemName] then + goto INNER_CONTINUE + end end testedStem[stemName] = true diff --git a/script/core/completion/completion.lua b/script/core/completion/completion.lua index c1b942b0..0ec503de 100644 --- a/script/core/completion/completion.lua +++ b/script/core/completion/completion.lua @@ -130,7 +130,7 @@ local function findNearestTable(state, position) end end if field.type == 'tableindex' then - if field.index.type == 'string' then + if field.index and field.index.type == 'string' then if field.index.finish >= position then return source else @@ -443,6 +443,7 @@ local function checkFieldFromFieldToIndex(state, name, src, parent, word, startP or config.get(state.uri, 'Lua.runtime.unicodeName') then return nil end + name = ('%q'):format(name) end local textEdit, additionalTextEdits local startOffset = guide.positionToOffset(state, startPos) @@ -459,12 +460,7 @@ local function checkFieldFromFieldToIndex(state, name, src, parent, word, startP wordStartOffset = offset - #word end local wordStartPos = guide.offsetToPosition(state, wordStartOffset) - local newText - if vm.getKeyType(src) == 'string' then - newText = ('[%q]'):format(name) - else - newText = ('[%s]'):format(name) - end + local newText = ('[%s]'):format(name) textEdit = { start = wordStartPos, finish = position, @@ -541,7 +537,7 @@ local function checkFieldThen(state, name, src, word, startPos, position, parent textEdit = { start = str.start + #str[2], finish = position, - newText = name, + newText = name:sub(#str[2] + 1, - #str[2] - 1), } else textEdit, additionalTextEdits = checkFieldFromFieldToIndex(state, name, src, parent, word, startPos, position) @@ -583,7 +579,7 @@ local function checkFieldOfRefs(refs, state, word, startPos, position, parent, o if isGlobal and locals and locals[name] then goto CONTINUE end - if not matchKey(word, name, count >= 100) then + if not matchKey(word, name:gsub([=[^['"]]=], ''), count >= 100) then goto CONTINUE end if not vm.isVisible(parent, src) then diff --git a/script/core/completion/keyword.lua b/script/core/completion/keyword.lua index 5558106a..e6f50242 100644 --- a/script/core/completion/keyword.lua +++ b/script/core/completion/keyword.lua @@ -1,6 +1,8 @@ local define = require 'proto.define' local files = require 'files' local guide = require 'parser.guide' +local config = require 'config' +local util = require 'utility' local keyWordMap = { { 'do', function(info, results) @@ -324,6 +326,66 @@ end" end return true end }, + { 'continue', function (info, results) + local nonstandardSymbol = config.get(info.uri, 'Lua.runtime.nonstandardSymbol') + if util.arrayHas(nonstandardSymbol, 'continue') then + return + end + local version = config.get(info.uri, 'Lua.runtime.version') + if version == 'Lua 5.1' then + return + end + local mostInsideBlock + guide.eachSourceContain(info.state.ast, info.start, function (src) + if src.type == 'while' + or src.type == 'in' + or src.type == 'loop' + or src.type == 'repeat' then + mostInsideBlock = src + end + end) + if not mostInsideBlock then + return + end + -- 找一下 end 的位置 + local endPos + if mostInsideBlock.type == 'while' then + endPos = mostInsideBlock.keyword[5] + elseif mostInsideBlock.type == 'in' then + endPos = mostInsideBlock.keyword[7] + elseif mostInsideBlock.type == 'loop' then + endPos = mostInsideBlock.keyword[5] + elseif mostInsideBlock.type == 'repeat' then + endPos = mostInsideBlock.keyword[3] + end + if not endPos then + return + end + local endLine = guide.rowColOf(endPos) + local tabStr = info.state.lua:sub( + info.state.lines[endLine], + guide.positionToOffset(info.state, endPos) + ) + local newText + if tabStr:match '^[\t ]*$' then + newText = ' ::continue::\n' .. tabStr + else + newText = '::continue::' + end + results[#results+1] = { + label = 'goto continue ..', + kind = define.CompletionItemKind.Snippet, + insertText = "goto continue", + additionalTextEdits = { + { + start = endPos, + finish = endPos, + newText = newText, + } + } + } + return true + end } } return keyWordMap diff --git a/script/core/completion/postfix.lua b/script/core/completion/postfix.lua index c5988ef6..1331a0e4 100644 --- a/script/core/completion/postfix.lua +++ b/script/core/completion/postfix.lua @@ -133,6 +133,39 @@ register 'xpcall' { end } +register 'ifcall' { + function (state, source, callback) + if source.type ~= 'getglobal' + and source.type ~= 'getfield' + and source.type ~= 'getmethod' + and source.type ~= 'getindex' + and source.type ~= 'getlocal' + and source.type ~= 'call' then + return + end + local subber = subString(state) + if source.type == 'call' then + if source.args and #source.args > 0 then + callback(string.format('if %s then %s(%s) end$0' + , subber(source.node.start + 1, source.node.finish) + , subber(source.node.start + 1, source.node.finish) + , subber(source.args[1].start + 1, source.args[#source.args].finish) + )) + else + callback(string.format('if %s then %s() end$0' + , subber(source.node.start + 1, source.node.finish) + , subber(source.node.start + 1, source.node.finish) + )) + end + else + callback(string.format('if %s then %s($1) end$0' + , subber(source.node.start + 1, source.node.finish) + , subber(source.node.start + 1, source.node.finish) + )) + end + end +} + register 'local' { function (state, source, callback) if source.type ~= 'getglobal' diff --git a/script/core/diagnostics/duplicate-set-field.lua b/script/core/diagnostics/duplicate-set-field.lua index 9d6f10ce..a4b205dd 100644 --- a/script/core/diagnostics/duplicate-set-field.lua +++ b/script/core/diagnostics/duplicate-set-field.lua @@ -11,6 +11,22 @@ local sourceTypes = { 'setindex', } +---@param source parser.object +---@return parser.object? +local function getTopFunctionOfIf(source) + while true do + if source.type == 'ifblock' + or source.type == 'elseifblock' + or source.type == 'elseblock' + or source.type == 'function' + or source.type == 'main' then + return source + end + source = source.parent + end + return nil +end + ---@async return function (uri, callback) local state = files.getState(uri) @@ -18,6 +34,10 @@ return function (uri, callback) return end + if vm.isMetaFile(uri) then + return + end + ---@async guide.eachSourceTypes(state.ast, sourceTypes, function (src) await.delay() @@ -29,6 +49,7 @@ return function (uri, callback) if not value or value.type ~= 'function' then return end + local myTopBlock = getTopFunctionOfIf(src) local defs = vm.getDefs(src) for _, def in ipairs(defs) do if def == src then @@ -39,6 +60,10 @@ return function (uri, callback) and def.type ~= 'setindex' then goto CONTINUE end + local defTopBlock = getTopFunctionOfIf(def) + if uri == guide.getUri(def) and myTopBlock ~= defTopBlock then + goto CONTINUE + end local defValue = vm.getObjectValue(def) if not defValue or defValue.type ~= 'function' then goto CONTINUE diff --git a/script/core/diagnostics/global-in-nil-env.lua b/script/core/diagnostics/global-in-nil-env.lua index e154080c..daf1f99d 100644 --- a/script/core/diagnostics/global-in-nil-env.lua +++ b/script/core/diagnostics/global-in-nil-env.lua @@ -13,6 +13,9 @@ return function (uri, callback) if node.tag == '_ENV' then return end + if guide.isParam(node) then + return + end if not node.value or node.value.type == 'nil' then callback { diff --git a/script/core/diagnostics/missing-return.lua b/script/core/diagnostics/missing-return.lua index 7333e5e3..2b5c90d2 100644 --- a/script/core/diagnostics/missing-return.lua +++ b/script/core/diagnostics/missing-return.lua @@ -7,7 +7,7 @@ local await = require 'await' ---@param block parser.object ---@return boolean local function hasReturn(block) - if block.hasReturn or block.hasError then + if block.hasReturn or block.hasExit then return true end if block.type == 'if' then diff --git a/script/core/diagnostics/param-type-mismatch.lua b/script/core/diagnostics/param-type-mismatch.lua index 607d4b0e..da39c5e1 100644 --- a/script/core/diagnostics/param-type-mismatch.lua +++ b/script/core/diagnostics/param-type-mismatch.lua @@ -87,9 +87,6 @@ return function (uri, callback) await.delay() local funcNode = vm.compileNode(source.node) for i, arg in ipairs(source.args) do - if i == 1 and source.node.type == 'getmethod' then - goto CONTINUE - end local refNode = vm.compileNode(arg) if not refNode then goto CONTINUE @@ -99,7 +96,8 @@ return function (uri, callback) goto CONTINUE end if arg.type == 'getfield' - or arg.type == 'getindex' then + or arg.type == 'getindex' + or arg.type == 'self' then -- 由于无法对字段进行类型收窄, -- 因此将假值移除再进行检查 refNode = refNode:copy():setTruthy() diff --git a/script/core/diagnostics/unreachable-code.lua b/script/core/diagnostics/unreachable-code.lua index 4f0a38b7..cbffe4db 100644 --- a/script/core/diagnostics/unreachable-code.lua +++ b/script/core/diagnostics/unreachable-code.lua @@ -23,7 +23,7 @@ end ---@param block parser.object ---@return boolean local function hasReturn(block) - if block.hasReturn or block.hasError then + if block.hasReturn or block.hasExit then return true end if block.type == 'if' then diff --git a/script/core/semantic-tokens.lua b/script/core/semantic-tokens.lua index 60a94281..0e27e8b8 100644 --- a/script/core/semantic-tokens.lua +++ b/script/core/semantic-tokens.lua @@ -7,6 +7,7 @@ local guide = require 'parser.guide' local converter = require 'proto.converter' local config = require 'config' local linkedTable = require 'linked-table' +local client = require 'client' local Care = util.switch() : case 'getglobal' @@ -709,7 +710,8 @@ local function buildTokens(state, results) local tokens = {} local lastLine = 0 local lastStartChar = 0 - for i, source in ipairs(results) do + local index = 0 + for _, source in ipairs(results) do local startPos = source.start local finishPos = source.finish local line = startPos.line @@ -718,18 +720,23 @@ local function buildTokens(state, results) local deltaStartChar if deltaLine == 0 then deltaStartChar = startChar - lastStartChar + if deltaStartChar == 0 then + goto continue + end else deltaStartChar = startChar end lastLine = line lastStartChar = startChar -- see https://microsoft.github.io/language-server-protocol/specifications/specification-3-16/#textDocument_semanticTokens - local len = i * 5 - 5 + index = index + 1 + local len = index * 5 - 5 tokens[len + 1] = deltaLine tokens[len + 2] = deltaStartChar tokens[len + 3] = finishPos.character - startPos.character -- length tokens[len + 4] = source.type tokens[len + 5] = source.modifieres or 0 + ::continue:: end return tokens end @@ -794,7 +801,12 @@ local function solveMultilineAndOverlapping(state, results) for token in tokens:pairs() do local startPos = converter.packPosition(state, token.start) local endPos = converter.packPosition(state, token.finish) - if endPos.line == startPos.line then + if startPos.line == endPos.line + and startPos.character == endPos.character then + goto continue + end + if endPos.line == startPos.line + or client.getAbility 'textDocument.semanticTokens.multilineTokenSupport' then new[#new+1] = { start = startPos, finish = endPos, @@ -825,6 +837,7 @@ local function solveMultilineAndOverlapping(state, results) } end end + ::continue:: end return new diff --git a/script/file-uri.lua b/script/file-uri.lua index 3e916acf..8e9dd938 100644 --- a/script/file-uri.lua +++ b/script/file-uri.lua @@ -106,7 +106,7 @@ function m.isValid(uri) end function m.normalize(uri) - if uri == '' then + if not m.isValid(uri) then return uri end return m.encode(m.decode(uri)) diff --git a/script/files.lua b/script/files.lua index 05ca1330..62f01136 100644 --- a/script/files.lua +++ b/script/files.lua @@ -79,6 +79,9 @@ end ---@return uri function m.getRealUri(uri) if platform.OS ~= 'Windows' then + return furi.normalize(uri) + end + if not furi.isValid(uri) then return uri end local filename = furi.decode(uri) @@ -887,6 +890,41 @@ function m.countStates() return n end +---@param path string +---@return string +function m.normalize(path) + path = path:gsub('%$%{(.-)%}', function (key) + if key == '3rd' then + return (ROOT / 'meta' / '3rd'):string() + end + if key:sub(1, 4) == 'env:' then + local env = os.getenv(key:sub(5)) + return env + end + end) + path = util.expandPath(path) + path = path:gsub('^%.[/\\]+', '') + for _ = 1, 1000 do + if path:sub(1, 2) == '..' then + break + end + local count + path, count = path:gsub('[^/\\]+[/\\]+%.%.[/\\]', '/', 1) + if count == 0 then + break + end + end + if platform.OS == 'Windows' then + path = path:gsub('[/\\]+', '\\') + :gsub('[/\\]+$', '') + :gsub('^(%a:)$', '%1\\') + else + path = path:gsub('[/\\]+', '/') + :gsub('[/\\]+$', '') + end + return path +end + --- 注册事件 ---@param callback async fun(ev: string, uri: uri) function m.watch(callback) diff --git a/script/filewatch.lua b/script/filewatch.lua index 72f5eec5..a8fa925f 100644 --- a/script/filewatch.lua +++ b/script/filewatch.lua @@ -2,6 +2,7 @@ local fw = require 'bee.filewatch' local fs = require 'bee.filesystem' local plat = require 'bee.platform' local await = require 'await' +local files = require 'files' local MODIFY = 1 << 0 local RENAME = 1 << 1 @@ -32,18 +33,25 @@ local m = {} m._eventList = {} m._watchings = {} +---@async ---@param path string ---@param recursive boolean -function m.watch(path, recursive) - if path == '' then +---@param filter? fun(path: string):boolean +function m.watch(path, recursive, filter) + if path == '' or not fs.is_directory(fs.path(path)) then return function () end end if m._watchings[path] then m._watchings[path].count = m._watchings[path].count + 1 else local watch = fw.create() + if recursive then + watch:set_recursive(true) + watch:set_follow_symlinks(true) + watch:set_filter(filter) + end + log.debug('Watch add:', path) watch:add(path) - watch:recursive(recursive) m._watchings[path] = { count = 1, watch = watch, @@ -86,6 +94,7 @@ function m.update() if not ev then break end + path = files.normalize(path) log.debug('filewatch:', ev, path) if not collect then collect = {} diff --git a/script/gc.lua b/script/gc.lua index 7bb81569..ff22195e 100644 --- a/script/gc.lua +++ b/script/gc.lua @@ -27,7 +27,9 @@ local function isRemoved(obj) for i = 1, 1000 do local n, v = debug.getupvalue(obj, i) if not n then - log.warn('函数式析构器没有 removed 上值!', util.dump(debug.getinfo(obj))) + if i > 1 then + log.warn('函数式析构器没有 removed 上值!', util.dump(debug.getinfo(obj))) + end break end if n == 'removed' then diff --git a/script/glob/gitignore.lua b/script/glob/gitignore.lua index de8fd005..fef0a0d7 100644 --- a/script/glob/gitignore.lua +++ b/script/glob/gitignore.lua @@ -49,6 +49,7 @@ local parser = m.P { ---@field errors table[] ---@field matcher table ---@field interface function[] +---@field data table local mt = {} mt.__index = mt mt.__name = 'gitignore' @@ -90,9 +91,9 @@ function mt:setInterface(key, func) self.interface[key] = func end -function mt:callInterface(name, ...) +function mt:callInterface(name, params) local func = self.interface[name] - return func(...) + return func(params, self.data) end function mt:hasInterface(name) @@ -223,6 +224,7 @@ return function (pattern, options, interface) matcher = {}, errors = {}, interface = {}, + data = {}, }, mt) if type(options) == 'table' then diff --git a/script/global.d.lua b/script/global.d.lua index 7e568b94..c120c153 100644 --- a/script/global.d.lua +++ b/script/global.d.lua @@ -69,3 +69,7 @@ CACHEALIVE = false -- (experiment) Compile files in multi cpu cores ---@type integer COMPILECORES = 0 + +-- TODO: delete this after new config +---@diagnostic disable-next-line: lowercase-global +jit = false diff --git a/script/json-beautify.lua b/script/json-beautify.lua index f86a7625..f3467f07 100644 --- a/script/json-beautify.lua +++ b/script/json-beautify.lua @@ -79,11 +79,13 @@ function encode_map.table(t) statusBuilder[#statusBuilder+1] = "{" statusDep = statusDep + 1 encode_newline() - local k = key[1] - statusBuilder[#statusBuilder+1] = '"' - statusBuilder[#statusBuilder+1] = encode_string(k) - statusBuilder[#statusBuilder+1] = '": ' - encode(t[k]) + do + local k = key[1] + statusBuilder[#statusBuilder+1] = '"' + statusBuilder[#statusBuilder+1] = encode_string(k) + statusBuilder[#statusBuilder+1] = '": ' + encode(t[k]) + end for i = 2, #key do local k = key[i] statusBuilder[#statusBuilder+1] = "," @@ -154,16 +156,21 @@ local function beautify_option(option) return setmetatable(option or {}, defaultOpt) end -local function beautify(v, option) +local function beautify_builder(builder, v, option) statusVisited = {} - statusBuilder = {} + statusBuilder = builder statusOpt = beautify_option(option) statusDep = statusOpt.depth encode(v) +end + +local function beautify(v, option) + beautify_builder({}, v, option) return table_concat(statusBuilder) end json.beautify = beautify -json.beautify_option = beautify_option +json._beautify_builder = beautify_builder +json._beautify_option = beautify_option return json diff --git a/script/json-edit.lua b/script/json-edit.lua index 7f20b523..30a55250 100644 --- a/script/json-edit.lua +++ b/script/json-edit.lua @@ -1,9 +1,9 @@ ----@diagnostic disable: param-type-mismatch - local type = type local next = next local error = error local tonumber = tonumber +local table_concat = table.concat +local table_move = table.move local string_char = string.char local string_byte = string.byte local string_find = string.find @@ -45,6 +45,12 @@ if _VERSION == "Lua 5.1" or _VERSION == "Lua 5.2" then end return "float" end + function table_move(a1, f, e, t, a2) + for i = f, e do + a2[t+(i-f)] = a1[i] + end + return a2 + end else utf8_char = utf8.char math_type = math.type @@ -376,6 +382,8 @@ local function decode_item() end end +local JsonEmpty = function () end + local function decode_ast(str) if type(str) ~= "string" then error("expected argument of type string, got " .. type(str)) @@ -384,7 +392,7 @@ local function decode_ast(str) statusPos = 1 statusTop = 0 if next_byte() == -1 then - return json.null + return {s = statusPos, d = statusTop, f = statusPos, v = JsonEmpty} end local res = decode() while statusTop > 0 do @@ -407,7 +415,7 @@ end local function query_(ast, pathlst, n) local data = ast.v if type(data) ~= "table" then - return + return nil, string_format("path `%s` does not point to object or array", "/"..table_concat(pathlst, "/", 1, n-1)) end local k = pathlst[n] local isarray = not json.isObject(data) @@ -416,28 +424,36 @@ local function query_(ast, pathlst, n) k = #data + 1 else if k:match "^0%d+" then - return + return nil, string_format("path `%s` point to array, but invalid", "/"..table_concat(pathlst, "/", 1, n)) end k = tonumber(k) if k == nil or math_type(k) ~= "integer" or k <= 0 or k > #data + 1 then - return + return nil, string_format("path `%s` point to array, but invalid", "/"..table_concat(pathlst, "/", 1, n)) end end end if n == #pathlst then return ast, k, isarray end - return query_(data[k], pathlst, n + 1) + local v = data[k] + if v == nil then + return ast, k, isarray, table_move(pathlst, n + 1, #pathlst, 1, {}) + end + return query_(v, pathlst, n + 1) end -local function query(ast, path) +local function split_path(path) if type(path) ~= "string" then - return + return nil, "path is not a string" end if path:sub(1,1) ~= "/" then - return + return nil, "path must start with `/`" end - return query_(ast, split(path:sub(2)), 1) + return split(path:sub(2)) +end + +local function query(ast, path) + return query_(ast, split_path(path), 1) end local function del_first_empty_line(str) @@ -475,50 +491,59 @@ local function find_max_node(t) return max end +local function encode_newline(option) + return option.newline..string_rep(option.indent, option.depth) +end + local function apply_array_insert_before(str, option, value, node) local start_text = str:sub(1, node.s-1) local finish_text = str:sub(node.s) option.depth = option.depth + node.d - return start_text - .. json.beautify(value, option) - .. "," - .. option.newline - .. string_rep(option.indent, option.depth) - .. finish_text + local bd = {} + bd[#bd+1] = start_text + json._beautify_builder(bd, value, option) + bd[#bd+1] = "," + bd[#bd+1] = encode_newline(option) + bd[#bd+1] = finish_text + return table_concat(bd) end local function apply_array_insert_after(str, option, value, node) local start_text = str:sub(1, node.f-1) local finish_text = str:sub(node.f) option.depth = option.depth + node.d - return start_text - .. "," - .. option.newline - .. string_rep(option.indent, option.depth) - .. json.beautify(value, option) - .. finish_text + local bd = {} + bd[#bd+1] = start_text + bd[#bd+1] = "," + bd[#bd+1] = encode_newline(option) + json._beautify_builder(bd, value, option) + bd[#bd+1] = finish_text + return table_concat(bd) end local function apply_array_insert_empty(str, option, value, node) local start_text = str:sub(1, node.s) local finish_text = str:sub(node.f-1) option.depth = option.depth + node.d + 1 - return start_text - .. option.newline - .. string_rep(option.indent, option.depth) - .. json.beautify(value, option) - .. option.newline - .. string_rep(option.indent, option.depth-1) - .. finish_text + local bd = {} + bd[#bd+1] = start_text + bd[#bd+1] = encode_newline(option) + json._beautify_builder(bd, value, option) + option.depth = option.depth - 1 + bd[#bd+1] = encode_newline(option) + bd[#bd+1] = finish_text + return table_concat(bd) end local function apply_replace(str, option, value, node) local start_text = str:sub(1, node.s-1) local finish_text = str:sub(node.f) option.depth = option.depth + node.d - return start_text - .. json.beautify(value, option) - .. finish_text + local bd = {} + bd[#bd+1] = start_text + json._beautify_builder(bd, value, option) + bd[#bd+1] = finish_text + return table_concat(bd) end local function apply_object_insert(str, option, value, t, k) @@ -527,29 +552,31 @@ local function apply_object_insert(str, option, value, t, k) local start_text = str:sub(1, node.f-1) local finish_text = str:sub(node.f) option.depth = option.depth + node.d - return start_text - .. "," - .. option.newline - .. string_rep(option.indent, option.depth) - .. '"' - .. json._encode_string(k) - .. '": ' - .. json.beautify(value, option) - .. finish_text + local bd = {} + bd[#bd+1] = start_text + bd[#bd+1] = "," + bd[#bd+1] = encode_newline(option) + bd[#bd+1] = '"' + bd[#bd+1] = json._encode_string(k) + bd[#bd+1] = '": ' + json._beautify_builder(bd, value, option) + bd[#bd+1] = finish_text + return table_concat(bd) else local start_text = str:sub(1, t.s) local finish_text = str:sub(t.f-1) option.depth = option.depth + t.d + 1 - return start_text - .. option.newline - .. string_rep(option.indent, option.depth) - .. '"' - .. json._encode_string(k) - .. '": ' - .. json.beautify(value, option) - .. option.newline - .. string_rep(option.indent, option.depth-1) - .. finish_text + local bd = {} + bd[#bd+1] = start_text + bd[#bd+1] = encode_newline(option) + bd[#bd+1] = '"' + bd[#bd+1] = json._encode_string(k) + bd[#bd+1] = '": ' + json._beautify_builder(bd, value, option) + option.depth = option.depth - 1 + bd[#bd+1] = encode_newline(option) + bd[#bd+1] = finish_text + return table_concat(bd) end end @@ -565,20 +592,33 @@ local function apply_remove(str, s, f) end end +local function add_prefix(v, pathlst) + for i = #pathlst, 1, -1 do + v = { [pathlst[i]] = v } + end + return v +end + local OP = {} function OP.add(str, option, path, value) - if value == nil then - return - end - if path == '' then + if path == '/' then return json.beautify(value, option) end local ast = decode_ast(str) - local t, k, isarray = query(ast, path) + if ast.v == JsonEmpty then + local pathlst = split_path(path) + value = add_prefix(value, pathlst) + return json.beautify(value, option) + end + local t, k, isarray, lastpath = query(ast, path) if not t then + error(k) return end + if lastpath then + value = add_prefix(value, lastpath) + end if isarray then if t.v[k] then return apply_array_insert_before(str, option, value, t.v[k]) @@ -597,39 +637,55 @@ function OP.add(str, option, path, value) end function OP.remove(str, _, path) - if path == '' then + if path == '/' then return '' end local ast = decode_ast(str) - local t, k, isarray = query(ast, path) + if ast.v == JsonEmpty then + return '' + end + local t, k, isarray, lastpath = query(ast, path) if not t then + error(k) return end + if lastpath then + --warning: path does not exist + return str + end if isarray then if k > #t.v then - return + --warning: path does not exist + return str end return apply_remove(str, t.v[k].s, t.v[k].f) else if t.v[k] == nil then - return + --warning: path does not exist + return str end return apply_remove(str, t.v[k].key_s, t.v[k].f) end end function OP.replace(str, option, path, value) - if value == nil then - return - end - if path == '' then + if path == '/' then return json.beautify(value, option) end local ast = decode_ast(str) - local t, k, isarray = query(ast, path) + if ast.v == JsonEmpty then + local pathlst = split_path(path) + value = add_prefix(value, pathlst) + return json.beautify(value, option) + end + local t, k, isarray, lastpath = query(ast, path) if not t then + error(k) return end + if lastpath then + value = add_prefix(value, lastpath) + end if t.v[k] then return apply_replace(str, option, value, t.v[k]) else @@ -648,9 +704,10 @@ end local function edit(str, patch, option) local f = OP[patch.op] if not f then + error(string_format("invalid op: %s", patch.op)) return end - option = json.beautify_option(option) + option = json._beautify_option(option) return f(str, option, patch.path, patch.value) end diff --git a/script/json.lua b/script/json.lua index 899d8c36..eaccb43e 100644 --- a/script/json.lua +++ b/script/json.lua @@ -183,11 +183,13 @@ function encode_map.table(t) keys[#keys+1] = k end table_sort(keys) - local k = keys[1] - statusBuilder[#statusBuilder+1] = '{"' - statusBuilder[#statusBuilder+1] = encode_string(k) - statusBuilder[#statusBuilder+1] = '":' - encode(t[k]) + do + local k = keys[1] + statusBuilder[#statusBuilder+1] = '{"' + statusBuilder[#statusBuilder+1] = encode_string(k) + statusBuilder[#statusBuilder+1] = '":' + encode(t[k]) + end for i = 2, #keys do local k = keys[i] statusBuilder[#statusBuilder+1] = ',"' @@ -219,6 +221,10 @@ function encode_map.table(t) if t[1] == nil then error("invalid table: sparse array is not supported") end + if jit and t[0] ~= nil then + -- 0 is the first index in luajit + error("invalid table: mixed or invalid key types: "..0) + end statusBuilder[#statusBuilder+1] = "[" encode(t[1]) local count = 2 diff --git a/script/library.lua b/script/library.lua index 03b9a590..3a9bbbc6 100644 --- a/script/library.lua +++ b/script/library.lua @@ -543,6 +543,7 @@ local function check3rdByWords(uri, configs) for _, word in ipairs(cfg.words) do await.delay() if wholeMatch(text, word) then + log.info('Found 3rd library by word: ', word, uri, library, inspect(config.get(uri, 'Lua.workspace.library'))) ---@async await.call(function () askFor3rd(uri, cfg) @@ -578,6 +579,7 @@ local function check3rdByFileName(uri, configs) for _, filename in ipairs(cfg.files) do await.delay() if wholeMatch(path, filename) then + log.info('Found 3rd library by filename: ', filename, uri, library, inspect(config.get(uri, 'Lua.workspace.library'))) ---@async await.call(function () askFor3rd(uri, cfg) diff --git a/script/meta/bee/filesystem.lua b/script/meta/bee/filesystem.lua index 6190dac7..c4267b97 100644 --- a/script/meta/bee/filesystem.lua +++ b/script/meta/bee/filesystem.lua @@ -31,11 +31,11 @@ end ---@class fs.status local fsStatus = {} ----@return string +---@return 'none' | 'not_found' | 'regular' | 'directory' | 'symlink' | 'block' | 'character' | 'fifo' | 'junction' | 'unknown' function fsStatus:type() end ----@class fs +---@class bee.filesystem local fs = {} ---@class fs.copy_options @@ -64,7 +64,7 @@ function fs.is_directory(path) end ---@param path fs.path ----@return fun():fs.path +---@return fun():fs.path, fs.status function fs.pairs(path) end diff --git a/script/meta/bee/filewatch.lua b/script/meta/bee/filewatch.lua new file mode 100644 index 00000000..b5211355 --- /dev/null +++ b/script/meta/bee/filewatch.lua @@ -0,0 +1,32 @@ +---@meta + +---@class bee.filewatch.instance +local instance = {} + +---@param path string +function instance:add(path) +end + +---@param enable boolean +---@return boolean +function instance:set_recursive(enable) +end + +---@param enable boolean +---@return boolean +function instance:set_follow_symlinks(enable) +end + +---@param callback? fun(path: string):boolean +---@return boolean +function instance:set_filter(callback) +end + +---@class bee.filewatch +local fw = {} + +---@return bee.filewatch.instance +function fw.create() +end + +return fw diff --git a/script/parser/compile.lua b/script/parser/compile.lua index 95483cc7..e09c958f 100644 --- a/script/parser/compile.lua +++ b/script/parser/compile.lua @@ -118,6 +118,7 @@ local Specials = { ['assert'] = true, ['error'] = true, ['type'] = true, + ['os.exit'] = true, } local UnarySymbol = { @@ -232,7 +233,7 @@ local ListFinishMap = { ['while'] = true, } -local State, Lua, Line, LineOffset, Chunk, Tokens, Index, LastTokenFinish, Mode, LocalCount +local State, Lua, Line, LineOffset, Chunk, Tokens, Index, LastTokenFinish, Mode, LocalCount, LocalLimited local LocalLimit = 200 @@ -433,7 +434,7 @@ local function resolveLongString(finishMark) end if finishMark == ']]' and State.version == 'Lua 5.1' then local nestOffset = sfind(Lua, '[[', start, true) - if nestOffset then + if nestOffset and nestOffset < finishOffset then fastForwardToken(nestOffset) local nestStartPos = getPosition(nestOffset, 'left') local nestFinishPos = getPosition(nestOffset + 1, 'right') @@ -728,7 +729,8 @@ local function createLocal(obj, attrs) end locals[#locals+1] = obj LocalCount = LocalCount + 1 - if LocalCount > LocalLimit then + if not LocalLimited and LocalCount > LocalLimit then + LocalLimited = true pushError { type = 'LOCAL_LIMIT', start = obj.start, @@ -1378,12 +1380,24 @@ local function parseNumber() return result end -local function isKeyWord(word) +local function isKeyWord(word, nextToken) if KeyWord[word] then return true end if word == 'goto' then - return State.version ~= 'Lua 5.1' + if State.version == 'Lua 5.1' then + return false + end + if State.version == 'LuaJIT' then + if not nextToken then + return false + end + if CharMapWord[ssub(nextToken, 1, 1)] then + return true + end + return false + end + return true end return false end @@ -1409,7 +1423,7 @@ local function parseName(asAction) finish = finishPos, } end - if isKeyWord(word) then + if isKeyWord(word, Tokens[Index + 1]) then pushError { type = 'KEYWORD', start = startPos, @@ -1490,7 +1504,7 @@ local function parseExpList(mini) break end local nextToken = peekWord() - if isKeyWord(nextToken) + if isKeyWord(nextToken, Tokens[Index + 2]) and nextToken ~= 'function' and nextToken ~= 'true' and nextToken ~= 'false' @@ -1960,6 +1974,12 @@ local function parseSimple(node, funcName) and node.node == lastMethod then lastMethod = nil end + if node.type == 'call' then + if node.node.special == 'error' + or node.node.special == 'os.exit' then + node.hasExit = true + end + end if node == lastMethod then if funcName then lastMethod = nil @@ -2222,7 +2242,7 @@ local function parseParams(params) finish = getPosition(Tokens[Index] + #token - 1, 'right'), } end - if isKeyWord(token) then + if isKeyWord(token, Tokens[Index + 3]) then pushError { type = 'KEYWORD', start = getPosition(Tokens[Index], 'left'), @@ -2252,8 +2272,6 @@ local function parseFunction(isLocal, isAction) }, } Index = Index + 2 - local LastLocalCount = LocalCount - LocalCount = 0 skipSpace(true) local hasLeftParen = Tokens[Index + 1] == '(' if not hasLeftParen then @@ -2289,6 +2307,8 @@ local function parseFunction(isLocal, isAction) hasLeftParen = Tokens[Index + 1] == '(' end end + local LastLocalCount = LocalCount + LocalCount = 0 pushChunk(func) local params if func.name and func.name.type == 'getmethod' then @@ -2351,7 +2371,16 @@ local function parseFunction(isLocal, isAction) return func end -local function pushErrorNeedParen(source) +local function checkNeedParen(source) + local token = Tokens[Index + 1] + if token ~= '.' + and token ~= ':' then + return source + end + local exp = parseSimple(source, false) + if exp == source then + return exp + end pushError { type = 'NEED_PAREN', start = source.start, @@ -2370,6 +2399,7 @@ local function pushErrorNeedParen(source) } } } + return exp end local function parseExpUnit() @@ -2389,10 +2419,7 @@ local function parseExpUnit() if not table then return nil end - local exp = parseSimple(table, false) - if exp ~= table then - pushErrorNeedParen(table) - end + local exp = checkNeedParen(table) return exp end @@ -2401,10 +2428,7 @@ local function parseExpUnit() if not string then return nil end - local exp = parseSimple(string, false) - if exp ~= string then - pushErrorNeedParen(string) - end + local exp = checkNeedParen(string) return exp end @@ -2413,10 +2437,7 @@ local function parseExpUnit() if not string then return nil end - local exp = parseSimple(string, false) - if exp ~= string then - pushErrorNeedParen(string) - end + local exp = checkNeedParen(string) return exp end @@ -2869,6 +2890,8 @@ local function compileExpAsAction(exp) local isLocal if exp.type == 'getlocal' and exp[1] == State.ENVMode then exp.special = nil + -- TODO: need + 1 at the end + LocalCount = LocalCount - 1 local loc = createLocal(exp, parseLocalAttrs()) loc.locPos = exp.start loc.effect = maxinteger @@ -2883,14 +2906,14 @@ local function compileExpAsAction(exp) end if exp.type == 'call' then - if exp.node.special == 'error' then + if exp.hasExit then for i = #Chunk, 1, -1 do local block = Chunk[i] if block.type == 'ifblock' or block.type == 'elseifblock' or block.type == 'elseblock' or block.type == 'function' then - block.hasError = true + block.hasExit = true break end end @@ -3374,6 +3397,7 @@ local function parseFor() missName() end skipSpace() + local forStateVars -- for i = if expectAssign() then action.type = 'loop' @@ -3388,6 +3412,9 @@ local function parseFor() name = nameOrList[1] end end + -- for x in ... uses 4 variables + forStateVars = 3 + LocalCount = LocalCount + forStateVars if name then local loc = createLocal(name) loc.parent = action @@ -3479,6 +3506,13 @@ local function parseFor() missExp() end + if State.version == 'Lua 5.4' then + forStateVars = 4 + else + forStateVars = 3 + end + LocalCount = LocalCount + forStateVars + if list then local lastName = list[#list] list.range = lastName and lastName.range or inRight @@ -3540,6 +3574,9 @@ local function parseFor() if action.locals then LocalCount = LocalCount - #action.locals end + if forStateVars then + LocalCount = LocalCount - forStateVars + end return action end @@ -3767,7 +3804,7 @@ function parseAction() return parseRepeat() end - if token == 'goto' and isKeyWord 'goto' then + if token == 'goto' and isKeyWord('goto', Tokens[Index + 3]) then return parseGoTo() end @@ -3867,6 +3904,7 @@ local function initState(lua, version, options) LineOffset = 1 LastTokenFinish = 0 LocalCount = 0 + LocalLimited = false Chunk = {} Tokens = tokens(lua) Index = 1 diff --git a/script/parser/guide.lua b/script/parser/guide.lua index 7f569d71..e7eb3751 100644 --- a/script/parser/guide.lua +++ b/script/parser/guide.lua @@ -72,7 +72,7 @@ local type = type ---@field hasGoTo? true ---@field hasReturn? true ---@field hasBreak? true ----@field hasError? true +---@field hasExit? true ---@field [integer] parser.object|any ---@field package _root parser.object @@ -82,7 +82,8 @@ local m = {} m.ANY = {"<ANY>"} -m.namePattern = '[%a_\x80-\xff][%w_\x80-\xff]*' +m.notNamePattern = '[^%w_\x80-\xff]' +m.namePattern = '[%a_\x80-\xff][%w_\x80-\xff]*' m.namePatternFull = '^' .. m.namePattern .. '$' local blockTypes = { @@ -478,6 +479,9 @@ function m.getLocal(source, name, pos) if not block then return nil end + if block.type == 'main' then + break + end if block.start <= pos and block.finish >= pos and blockTypes[block.type] then @@ -1272,4 +1276,17 @@ function m.getTopBlock(source) return nil end +---@param source parser.object +---@return boolean +function m.isParam(source) + if source.type ~= 'local' + and source.type ~= 'self' then + return false + end + if source.parent.type ~= 'funcargs' then + return false + end + return true +end + return m diff --git a/script/provider/diagnostic.lua b/script/provider/diagnostic.lua index 90c5a81c..ebbe3e36 100644 --- a/script/provider/diagnostic.lua +++ b/script/provider/diagnostic.lua @@ -642,6 +642,12 @@ function m.pullDiagnosticScope(callback) end function m.refreshClient() + if not client.isReady() then + return + end + if not client.getAbility 'workspace.diagnostics.refreshSupport' then + return + end log.debug('Refresh client diagnostics') proto.request('workspace/diagnostic/refresh', json.null) end diff --git a/script/provider/formatting.lua b/script/provider/formatting.lua index 4ec5545a..73f9a534 100644 --- a/script/provider/formatting.lua +++ b/script/provider/formatting.lua @@ -90,7 +90,7 @@ function m.updateNonStandardSymbols(symbols) end if #eqTokens ~= 0 then - codeFormat.set_nonstandard_symbol('=', eqTokens) + codeFormat.set_nonstandard_symbol() end end diff --git a/script/provider/markdown.lua b/script/provider/markdown.lua index 50716073..fe1b26b2 100644 --- a/script/provider/markdown.lua +++ b/script/provider/markdown.lua @@ -71,6 +71,10 @@ function mt:string(nl) elseif obj.type == 'emptyline' then if #lines > 0 and lines[#lines] ~= '' then + if language ~= 'md' then + language = 'md' + lines[#lines+1] = '```' + end lines[#lines+1] = '' end elseif obj.type == 'markdown' then diff --git a/script/provider/provider.lua b/script/provider/provider.lua index f9f5fa29..2e6d8f75 100644 --- a/script/provider/provider.lua +++ b/script/provider/provider.lua @@ -114,10 +114,10 @@ m.register 'initialize' { if params.workspaceFolders then for _, folder in ipairs(params.workspaceFolders) do - workspace.create(folder.uri) + workspace.create(files.getRealUri(folder.uri)) end elseif params.rootUri then - workspace.create(params.rootUri) + workspace.create(files.getRealUri(params.rootUri)) end local response = { @@ -249,12 +249,14 @@ m.register 'workspace/didChangeWorkspaceFolders' { function (params) log.debug('workspace/didChangeWorkspaceFolders', inspect(params)) for _, folder in ipairs(params.event.added) do - workspace.create(folder.uri) + local uri = files.getRealUri(folder.uri) + workspace.create(uri) m.updateConfig() - workspace.reload(scope.getScope(folder.uri)) + workspace.reload(scope.getScope(uri)) end for _, folder in ipairs(params.event.removed) do - workspace.remove(folder.uri) + local uri = files.getRealUri(folder.uri) + workspace.remove(uri) end end } @@ -263,12 +265,7 @@ m.register 'textDocument/didOpen' { ---@async function (params) local doc = params.textDocument - local scheme = furi.split(doc.uri) - local supports = config.get(doc.uri, 'Lua.workspace.supportScheme') - if not util.arrayHas(supports, scheme) then - return - end - local uri = files.getRealUri(doc.uri) + local uri = files.getRealUri(doc.uri) log.debug('didOpen', uri) local text = doc.text files.setText(uri, text, true, function (file) @@ -296,11 +293,6 @@ m.register 'textDocument/didChange' { ---@async function (params) local doc = params.textDocument - local scheme = furi.split(doc.uri) - local supports = config.get(doc.uri, 'Lua.workspace.supportScheme') - if not util.arrayHas(supports, scheme) then - return - end local changes = params.contentChanges local uri = files.getRealUri(doc.uri) workspace.awaitReady(uri) @@ -605,19 +597,7 @@ m.register 'textDocument/completion' { function (params) local uri = files.getRealUri(params.textDocument.uri) if not workspace.isReady(uri) then - local count, max = workspace.getLoadingProcess(uri) - return { - { - label = lang.script('HOVER_WS_LOADING', count, max), - textEdit = { - range = { - start = params.position, - ['end'] = params.position, - }, - newText = '', - }, - } - } + return nil end local _ <close> = progress.create(uri, lang.script.WINDOW_PROCESSING_COMPLETION, 0.5) --log.info(util.dump(params)) @@ -973,6 +953,7 @@ m.register 'workspace/executeCommand' { 'lua.solve', 'lua.jsonToLua', 'lua.setConfig', + 'lua.getConfig', 'lua.autoRequire', }, }, @@ -991,10 +972,16 @@ m.register 'workspace/executeCommand' { return core(params.arguments[1]) elseif command == 'lua.setConfig' then local core = require 'core.command.setConfig' - return core(params.arguments[1]) + return core(params.arguments) + elseif command == 'lua.getConfig' then + local core = require 'core.command.getConfig' + return core(params.arguments) elseif command == 'lua.autoRequire' then local core = require 'core.command.autoRequire' return core(params.arguments[1]) + elseif command == 'lua.exportDocument' then + local core = require 'core.command.exportDocument' + core(params.arguments) end end } diff --git a/script/string-merger.lua b/script/string-merger.lua index b2a63f02..65896575 100644 --- a/script/string-merger.lua +++ b/script/string-merger.lua @@ -127,6 +127,10 @@ function m.getOffsetBack(info, offset) finish = diff.finish end if not start or not finish then + if offset > diff.cstart + and offset < diff.cfinish then + return diff.finish, diff.finish + end local soff = offset - diff.cstart local pos = math.min(diff.start + soff, diff.finish) start = start or pos diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index a6eda13e..8487ec56 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -192,11 +192,11 @@ local searchFieldSwitch = util.switch() or not math.tointeger(key) then return end - pushResult(source.node) + pushResult(source.node, true) end if type(key) == 'table' then if vm.isSubType(suri, key, 'integer') then - pushResult(source.node) + pushResult(source.node, true) end end end) @@ -217,21 +217,21 @@ local searchFieldSwitch = util.switch() or (fn.name == 'number' and type(key) == 'number') or (fn.name == 'integer' and math.tointeger(key)) or (fn.name == 'string' and type(key) == 'string') then - pushResult(field) + pushResult(field, true) end elseif fn.type == 'doc.type.string' or fn.type == 'doc.type.integer' or fn.type == 'doc.type.boolean' then if key == vm.ANY or fn[1] == key then - pushResult(field) + pushResult(field, true) end end end end if fieldKey.type == 'doc.field.name' then if key == vm.ANY or fieldKey[1] == key then - pushResult(field) + pushResult(field, true) end end end @@ -1177,7 +1177,8 @@ local compilerSwitch = util.switch() end -- { f = function (<?x?>) end } - if guide.isAssign(parent) then + if guide.isAssign(parent) + and parent.value == source then vm.setNode(source, vm.compileNode(parent)) end end) @@ -1284,6 +1285,9 @@ local compilerSwitch = util.switch() if source.node[1] ~= '_ENV' then return end + if not source.value then + return + end vm.setNode(source, vm.compileNode(source.value)) end) : case 'getglobal' @@ -1324,6 +1328,18 @@ local compilerSwitch = util.switch() end end + if not hasMarkDoc and source.type == 'tableindex' then + vm.compileByParentNode(source.node, vm.ANY, function (src) + if src.type == 'doc.field' + or src.type == 'doc.type.field' then + if vm.isSubType(guide.getUri(source), vm.compileNode(source.index), vm.compileNode(src.field or src.name)) then + hasMarkDoc = true + vm.setNode(source, vm.compileNode(src)) + end + end + end) + end + if not hasMarkDoc and source.value then vm.setNode(source, vm.compileNode(source.value)) end @@ -1341,6 +1357,7 @@ local compilerSwitch = util.switch() if src.type == 'doc.field' or src.type == 'doc.type.field' or src.type == 'doc.type.name' + or src.type == 'doc.type' or guide.isLiteral(src) then hasMarkDoc = true vm.setNode(source, vm.compileNode(src)) @@ -1471,6 +1488,21 @@ local compilerSwitch = util.switch() return end if func.special == 'require' then + if index == 2 then + local uri = guide.getUri(source) + local version = config.get(uri, 'Lua.runtime.version') + if version == 'Lua 5.3' + or version == 'Lua 5.4' then + vm.setNode(source, vm.declareGlobal('type', 'unknown')) + else + vm.setNode(source, vm.declareGlobal('type', 'nil')) + end + return + end + if index >= 3 then + vm.setNode(source, vm.declareGlobal('type', 'nil')) + return + end if not args then return end @@ -1739,11 +1771,15 @@ local compilerSwitch = util.switch() vm.setNode(source, global) if global.cate == 'variable' then for luri, link in pairs(global.links) do - if luri ~= uri then - local firstSet = link.sets[1] - if firstSet then - local setNode = vm.compileNode(firstSet) - vm.setNode(source, setNode) + local firstSet = link.sets[1] + if firstSet then + local setNode = vm.compileNode(firstSet) + vm.setNode(source, setNode) + if vm.isMetaFile(luri) then + for i = 2, #link.sets do + setNode = vm.compileNode(link.sets[i]) + vm.setNode(source, setNode) + end end end end @@ -1873,10 +1909,9 @@ function vm.compileNode(source) ---@cast source parser.object vm.setNode(source, vm.createNode(), true) - if not vm.compileByGlobal(source) then - vm.compileByVariable(source) - compileByNode(source) - end + vm.compileByGlobal(source) + vm.compileByVariable(source) + compileByNode(source) compileByParentNode(source) matchCall(source) diff --git a/script/vm/infer.lua b/script/vm/infer.lua index 0b5a6dcb..94fdfd88 100644 --- a/script/vm/infer.lua +++ b/script/vm/infer.lua @@ -11,6 +11,7 @@ local vm = require 'vm.vm' ---@field _lastView? string ---@field _lastViewUri? uri ---@field _lastViewDefault? any +---@field _subViews? string[] local mt = {} mt.__index = mt mt._hasTable = false @@ -242,6 +243,16 @@ local viewNodeSwitch;viewNodeSwitch = util.switch() ---@class vm.node ---@field lastInfer? vm.infer +---@param node? vm.node +---@return vm.infer +local function createInfer(node) + local infer = setmetatable({ + node = node, + _drop = {}, + }, mt) + return infer +end + ---@param source vm.node.object | vm.node ---@return vm.infer function vm.getInfer(source) @@ -257,10 +268,7 @@ function vm.getInfer(source) if node.lastInfer then return node.lastInfer end - local infer = setmetatable({ - node = node, - _drop = {}, - }, mt) + local infer = createInfer(node) node.lastInfer = infer return infer @@ -310,9 +318,7 @@ function mt:_eraseAlias(uri) if set.type == 'doc.alias' then if expandAlias then self._drop[n.name] = true - local newInfer = setmetatable({ - _drop = {}, - }, mt) + local newInfer = createInfer() for _, ext in ipairs(set.extends.types) do viewNodeSwitch(ext.type, ext, newInfer, uri) end @@ -321,7 +327,7 @@ function mt:_eraseAlias(uri) end else for _, ext in ipairs(set.extends.types) do - local view = viewNodeSwitch(ext.type, ext, {}, uri) + local view = viewNodeSwitch(ext.type, ext, createInfer(), uri) if view and view ~= n.name then self._drop[view] = true end @@ -413,6 +419,7 @@ function mt:view(uri, default) end local array = {} + self._subViews = array for view in pairs(self.views) do if not self._drop[view] then array[#array+1] = view @@ -449,7 +456,8 @@ function mt:view(uri, default) if #array == 0 then view = 'nil' else - if max > 1 then + if max > 1 + or view:find(guide.notNamePattern .. guide.namePattern .. '$') then view = '(' .. view .. ')?' else view = view .. '?' @@ -471,6 +479,13 @@ function mt:eachView(uri) return next, self.views end +---@param uri uri +---@return string[] +function mt:getSubViews(uri) + self:view(uri) + return self._subViews +end + ---@return string? function mt:viewLiterals() if not self.node then @@ -483,7 +498,12 @@ function mt:viewLiterals() or n.type == 'number' or n.type == 'integer' or n.type == 'boolean' then - local literal = util.viewLiteral(n[1]) + local literal + if n.type == 'string' then + literal = util.viewString(n[1], n[2]) + else + literal = util.viewLiteral(n[1]) + end if literal and not mark[literal] then literals[#literals+1] = literal mark[literal] = true @@ -531,9 +551,7 @@ end ---@param uri uri ---@return string? function vm.viewObject(source, uri) - local infer = setmetatable({ - _drop = {}, - }, mt) + local infer = createInfer() return viewNodeSwitch(source.type, source, infer, uri) end @@ -550,19 +568,14 @@ function vm.viewKey(source, uri) return '[' .. key .. ']' end end - if source.type == 'tableindex' then + if source.type == 'tableindex' + or source.type == 'setindex' then local index = source.index - local name = vm.getKeyName(index) + local name = vm.getInfer(index):viewLiterals() if not name then return nil end - local key - if index.type == 'string' then - key = util.viewString(name, index[2]) - else - key = util.viewLiteral(name) - end - return ('[%s]'):format(key), name + return ('[%s]'):format(name), name end if source.type == 'tableexp' then return ('[%d]'):format(source.tindex), source.tindex diff --git a/script/vm/operator.lua b/script/vm/operator.lua index cb27d33d..9c68e648 100644 --- a/script/vm/operator.lua +++ b/script/vm/operator.lua @@ -73,15 +73,22 @@ local function checkOperators(operators, op, value, result) local valueNode = vm.compileNode(value) local expNode = vm.compileNode(operator.exp) local uri = guide.getUri(operator) - if not vm.isSubType(uri, valueNode, expNode) then - goto CONTINUE + for vo in valueNode:eachObject() do + if vm.isSubType(uri, vo, expNode) then + if not result then + result = vm.createNode() + end + result:merge(vm.compileNode(operator.extends)) + return result + end end + else + if not result then + result = vm.createNode() + end + result:merge(vm.compileNode(operator.extends)) + return result end - if not result then - result = vm.createNode() - end - result:merge(vm.compileNode(operator.extends)) - break ::CONTINUE:: end return result @@ -199,7 +206,10 @@ vm.binarySwitch = util.switch() elseif r1 == false then vm.setNode(source, node2) else - local node = node1:copy():setTruthy():merge(node2) + local node = node1:copy():setTruthy() + if not source[2].hasExit then + node:merge(node2) + end vm.setNode(source, node) end end) @@ -246,7 +256,9 @@ vm.binarySwitch = util.switch() }) else local node = vm.runOperator(binaryMap[op], source[1], source[2]) - vm.setNode(source, node or vm.declareGlobal('type', 'integer')) + if node then + vm.setNode(source, node) + end end end) : case '+' @@ -293,20 +305,17 @@ vm.binarySwitch = util.switch() local uri = guide.getUri(source) local infer1 = vm.getInfer(source[1]) local infer2 = vm.getInfer(source[2]) - if infer1:hasType(uri, 'integer') - or infer2:hasType(uri, 'integer') then - if not infer1:hasType(uri, 'number') - and not infer2:hasType(uri, 'number') then - vm.setNode(source, vm.declareGlobal('type', 'integer')) - return - end + if infer1:hasType(uri, 'integer') + and infer2:hasType(uri, 'integer') then + vm.setNode(source, vm.declareGlobal('type', 'integer')) + return + end + if (infer1:hasType(uri, 'number') or infer1:hasType(uri, 'integer')) + and (infer2:hasType(uri, 'number') or infer2:hasType(uri, 'integer')) then + vm.setNode(source, vm.declareGlobal('type', 'number')) + return end end - if op == '//' then - vm.setNode(source, node or vm.declareGlobal('type', 'integer')) - return - end - vm.setNode(source, node or vm.declareGlobal('type', 'number')) end end) : case '..' @@ -343,7 +352,9 @@ vm.binarySwitch = util.switch() }) else local node = vm.runOperator(binaryMap[source.op.type], source[1], source[2]) - vm.setNode(source, node or vm.declareGlobal('type', 'string')) + if node then + vm.setNode(source, node) + end end end) : case '>' diff --git a/script/vm/ref.lua b/script/vm/ref.lua index ba9bf453..89b9d3c0 100644 --- a/script/vm/ref.lua +++ b/script/vm/ref.lua @@ -29,7 +29,10 @@ simpleSwitch = util.switch() ---@async local function searchInAllFiles(suri, searcher, notify) + await.delay() + searcher(suri) + await.delay() local uris = {} for uri in files.eachFile(suri) do @@ -104,29 +107,28 @@ local function searchWord(source, pushResult, defMap, fileNotify) await.delay() end end) - else - ---@async - guide.eachSourceTypes(state.ast, {'getfield', 'setfield'}, function (src) - if src.field and src.field[1] == key then - checkDef(src) - await.delay() - end - end) - ---@async - guide.eachSourceTypes(state.ast, {'getmethod', 'setmethod'}, function (src) - if src.method and src.method[1] == key then - checkDef(src) - await.delay() - end - end) - ---@async - guide.eachSourceTypes(state.ast, {'getindex', 'setindex'}, function (src) - if src.index and src.index.type == 'string' and src.index[1] == key then - checkDef(src) - await.delay() - end - end) end + ---@async + guide.eachSourceTypes(state.ast, {'getfield', 'setfield'}, function (src) + if src.field and src.field[1] == key then + checkDef(src) + await.delay() + end + end) + ---@async + guide.eachSourceTypes(state.ast, {'getmethod', 'setmethod'}, function (src) + if src.method and src.method[1] == key then + checkDef(src) + await.delay() + end + end) + ---@async + guide.eachSourceTypes(state.ast, {'getindex', 'setindex'}, function (src) + if src.index and src.index.type == 'string' and src.index[1] == key then + checkDef(src) + await.delay() + end + end) end searchInAllFiles(guide.getUri(source), findWord, fileNotify) @@ -285,7 +287,10 @@ local function searchByDef(source, pushResult) local defs = vm.getDefs(source) for _, def in ipairs(defs) do pushResult(def) - if not guide.isLiteral(def) then + if not guide.isLiteral(def) + and def.type ~= 'doc.alias' + and def.type ~= 'doc.class' + and def.type ~= 'doc.enum' then defMap[def] = true end end diff --git a/script/vm/tracer.lua b/script/vm/tracer.lua index 823029f0..a8aa0c7c 100644 --- a/script/vm/tracer.lua +++ b/script/vm/tracer.lua @@ -282,6 +282,10 @@ local lookIntoChild = util.switch() ---@param topNode vm.node ---@param outNode? vm.node : call(function (tracer, action, topNode, outNode) + if action.type == 'loop' then + tracer:lookIntoChild(action.init, topNode) + tracer:lookIntoChild(action.max, topNode) + end if action[1] then tracer:lookIntoBlock(action, action.bstart, topNode:copy()) local lastAssign = tracer:getLastAssign(action.start, action.finish) @@ -369,7 +373,7 @@ local lookIntoChild = util.switch() local neverReturn = subBlock.hasReturn or subBlock.hasGoTo or subBlock.hasBreak - or subBlock.hasError + or subBlock.hasExit if neverReturn then mergedNode = true else @@ -530,7 +534,7 @@ local lookIntoChild = util.switch() ---@param outNode? vm.node : call(function (tracer, action, topNode, outNode) for _, ret in ipairs(action) do - tracer:lookIntoChild(ret, topNode) + tracer:lookIntoChild(ret, topNode:copy()) end return topNode, outNode end) @@ -571,7 +575,7 @@ local lookIntoChild = util.switch() for i = 2, #action.args do tracer:lookIntoChild(action.args[i], topNode, topNode:copy()) end - topNode = tracer:lookIntoChild(action.args[1], topNode, topNode:copy()) + topNode = tracer:lookIntoChild(action.args[1], topNode:copy(), topNode:copy()) end tracer:lookIntoChild(action.node, topNode) tracer:lookIntoChild(action.args, topNode) @@ -637,7 +641,8 @@ local lookIntoChild = util.switch() and handler.args[1] and tracer.getMap[handler.args[1]] then -- if type(x) == 'string' then - tracer:lookIntoChild(handler, topNode:copy()) + tracer:lookIntoChild(handler, topNode) + topNode = topNode:copy() if action.op.type == '==' then topNode:narrow(tracer.uri, checker[1]) if outNode then diff --git a/script/vm/type.lua b/script/vm/type.lua index d01ca020..756926ba 100644 --- a/script/vm/type.lua +++ b/script/vm/type.lua @@ -301,7 +301,9 @@ function vm.isSubType(uri, child, parent, mark, errs) end end if hasKnownType > 0 then - if errs and hasKnownType > 1 then + if errs + and hasKnownType > 1 + and #vm.getInfer(child):getSubViews(uri) > 1 then errs[#errs+1] = 'TYPE_ERROR_CHILD_ALL_DISMATCH' errs[#errs+1] = child errs[#errs+1] = parent @@ -376,7 +378,9 @@ function vm.isSubType(uri, child, parent, mark, errs) end end if hasKnownType > 0 then - if errs and hasKnownType > 1 then + if errs + and hasKnownType > 1 + and #vm.getInfer(parent):getSubViews(uri) > 1 then errs[#errs+1] = 'TYPE_ERROR_PARENT_ALL_DISMATCH' errs[#errs+1] = child errs[#errs+1] = parent @@ -703,6 +707,7 @@ local ErrorMessageMap = { ---@return string function vm.viewTypeErrorMessage(uri, errs) local lines = {} + local mark = {} local index = 1 while true do local name = errs[index] @@ -741,8 +746,17 @@ function vm.viewTypeErrorMessage(uri, errs) index = index + 1 end local line = lang.script(name, lparams) - lines[#lines+1] = '- ' .. line + if not mark[line] then + mark[line] = true + lines[#lines+1] = '- ' .. line + end end util.revertTable(lines) - return table.concat(lines, '\n') + if #lines > 15 then + lines[13] = ('...(+%d)'):format(#lines - 15) + table.move(lines, #lines - 2, #lines, 14) + return table.concat(lines, '\n', 1, 16) + else + return table.concat(lines, '\n') + end end diff --git a/script/workspace/loading.lua b/script/workspace/loading.lua index eff55e6c..5ddc4bda 100644 --- a/script/workspace/loading.lua +++ b/script/workspace/loading.lua @@ -94,6 +94,10 @@ function mt:loadFile(uri, libraryUri) if not content then return end + if files.getFile(uri) then + log.info(('Skip loaded file: %s'):format(uri)) + return + end log.info(('Preload file at: %s , size = %.3f KB'):format(uri, #content / 1024.0)) --await.wait(function (waker) -- self._sets[#self._sets+1] = waker @@ -129,6 +133,10 @@ function mt:loadFile(uri, libraryUri) if not content then return end + if files.getFile(uri) then + log.info(('Skip loaded file: %s'):format(uri)) + return + end log.info(('Preload dll at: %s , size = %.3f KB'):format(uri, #content / 1024.0)) --await.wait(function (waker) -- self._sets[#self._sets+1] = waker diff --git a/script/workspace/require-path.lua b/script/workspace/require-path.lua index d7ca8e26..c319cbad 100644 --- a/script/workspace/require-path.lua +++ b/script/workspace/require-path.lua @@ -68,6 +68,7 @@ function mt:getRequireResultByPath(path) if vm.isMetaFileRequireable(uri) then result[#result+1] = { name = metaName, + searcher = '[[meta]]', } end return result @@ -80,7 +81,7 @@ function mt:getRequireResultByPath(path) for _, searcher in ipairs(searchers) do local isAbsolute = searcher:match '^[/\\]' or searcher:match '^%a+%:' - searcher = workspace.normalize(searcher) + searcher = files.normalize(searcher) if searcher:sub(1, 1) == '.' then strict = true end @@ -157,7 +158,7 @@ function mt:getVisiblePath(path) and not self.scp:isLinkedUri(uri) then return {} end - path = workspace.normalize(path) + path = files.normalize(path) local result = self.visibleCache[path] if not result then result = self:getRequireResultByPath(path) @@ -195,7 +196,7 @@ function mt:searchUrisByRequireName(name) for _, searcher in ipairs(searchers) do local fspath = searcher:gsub('%?', (path:gsub('%%', '%%%%'))) - fspath = workspace.normalize(fspath) + fspath = files.normalize(fspath) local tail = '/' .. furi.encode(fspath):gsub('^file:[/]*', '') for uri in files.eachFile(self.scp.uri) do if not searcherMap[uri] @@ -211,7 +212,7 @@ function mt:searchUrisByRequireName(name) or relative == '/' or relative == '' then results[#results+1] = uri - searcherMap[uri] = workspace.normalize(relative .. searcher) + searcherMap[uri] = files.normalize(relative .. searcher) end end end @@ -293,7 +294,7 @@ function m.isMatchedUri(suri, uri, name) for _, searcher in ipairs(searchers) do local fspath = searcher:gsub('%?', (path:gsub('%%', '%%%%'))) - fspath = workspace.normalize(fspath) + fspath = files.normalize(fspath) local tail = '/' .. furi.encode(fspath):gsub('^file:[/]*', '') if util.stringEndWith(uri, tail) then local parentUri = files.getLibraryUri(suri, uri) or uri diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua index f08468c8..3e85e0fc 100644 --- a/script/workspace/workspace.lua +++ b/script/workspace/workspace.lua @@ -45,9 +45,6 @@ end --- 初始化工作区 function m.create(uri) - if furi.isValid(uri) then - uri = furi.normalize(uri) - end log.info('Workspace create: ', uri) local scp = scope.createFolder(uri) m.folders[#m.folders+1] = scp @@ -87,26 +84,45 @@ function m.getRootUri(uri) end local globInteferFace = { - type = function (path) + type = function (path, data) + if data[path] then + return data[path] + end local result pcall(function () - if fs.is_directory(path) then + if fs.is_directory(fs.path(path)) then result = 'directory' + data[path] = 'directory' else result = 'file' + data[path] = 'file' end end) return result end, - list = function (path) + list = function (path, data) + if data[path] == 'file' then + return nil + end local fullPath = fs.path(path) if not fs.is_directory(fullPath) then + data[path] = 'file' return nil end + data[path] = true local paths = {} pcall(function () - for fullpath in fs.pairs(fullPath) do - paths[#paths+1] = fullpath:string() + for fullpath, status in fs.pairs(fullPath) do + local pathString = fullpath:string() + paths[#paths+1] = pathString + local st = status:type() + if st == 'directory' + or st == 'symlink' + or st == 'junction' then + data[pathString] = 'directory' + else + data[pathString] = 'file' + end end end) return paths @@ -201,14 +217,14 @@ function m.getLibraryMatchers(scp) for _, path in ipairs(config.get(scp.uri, 'Lua.workspace.library')) do path = m.getAbsolutePath(scp.uri, path) if path then - librarys[m.normalize(path)] = true + librarys[files.normalize(path)] = true end end local metaPaths = scp:get 'metaPaths' log.debug('meta path:', inspect(metaPaths)) if metaPaths then for _, metaPath in ipairs(metaPaths) do - librarys[m.normalize(metaPath)] = true + librarys[files.normalize(metaPath)] = true end end @@ -228,13 +244,12 @@ function m.getLibraryMatchers(scp) end scp:set('libraryMatcher', matchers) - log.debug('library matcher:', inspect(matchers)) + --log.debug('library matcher:', inspect(matchers)) return matchers end --- 文件是否被忽略 ----@async ---@param uri uri function m.isIgnored(uri) local scp = scope.getScope(uri) @@ -311,7 +326,13 @@ function m.awaitPreload(scp) if scp.uri and not scp:get('bad root') then log.info('Scan files at:', scp:getName()) - scp:gc(fw.watch(m.normalize(furi.decode(scp.uri)), true)) + scp:gc(fw.watch(files.normalize(furi.decode(scp.uri)), true, function (path) + local rpath = m.getRelativePath(path) + if native(rpath) then + return false + end + return true + end)) local count = 0 ---@async native:scan(furi.decode(scp.uri), function (path) @@ -329,7 +350,13 @@ function m.awaitPreload(scp) for _, libMatcher in ipairs(librarys) do log.info('Scan library at:', libMatcher.uri) local count = 0 - scp:gc(fw.watch(furi.decode(libMatcher.uri), true)) + scp:gc(fw.watch(furi.decode(libMatcher.uri), true, function (path) + local rpath = m.getRelativePath(path) + if libMatcher.matcher(rpath) then + return false + end + return true + end)) scp:addLink(libMatcher.uri) ---@async libMatcher.matcher:scan(furi.decode(libMatcher.uri), function (path) @@ -374,52 +401,18 @@ function m.findUrisByFilePath(path) return results end ----@param path string ----@return string -function m.normalize(path) - path = path:gsub('%$%{(.-)%}', function (key) - if key == '3rd' then - return (ROOT / 'meta' / '3rd'):string() - end - if key:sub(1, 4) == 'env:' then - local env = os.getenv(key:sub(5)) - return env - end - end) - path = util.expandPath(path) - path = path:gsub('^%.[/\\]+', '') - for _ = 1, 1000 do - if path:sub(1, 2) == '..' then - break - end - local count - path, count = path:gsub('[^/\\]+[/\\]+%.%.[/\\]', '/', 1) - if count == 0 then - break - end - end - if platform.OS == 'Windows' then - path = path:gsub('[/\\]+', '\\') - :gsub('[/\\]+$', '') - :gsub('^(%a:)$', '%1\\') - else - path = path:gsub('[/\\]+', '/') - :gsub('[/\\]+$', '') - end - return path -end ---@param folderUri? uri ---@param path string ---@return string? function m.getAbsolutePath(folderUri, path) - path = m.normalize(path) + path = files.normalize(path) if fs.path(path):is_relative() then if not folderUri then return nil end local folderPath = furi.decode(folderUri) - path = m.normalize(folderPath .. '/' .. path) + path = files.normalize(folderPath .. '/' .. path) end return path end @@ -438,14 +431,14 @@ function m.getRelativePath(uriOrPath) end local scp = scope.getScope(uri) if not scp.uri then - local relative = m.normalize(path) + local relative = files.normalize(path) return relative:gsub('^[/\\]+', ''), false end - local _, pos = m.normalize(path):find(furi.decode(scp.uri), 1, true) + local _, pos = files.normalize(path):find(furi.decode(scp.uri), 1, true) if pos then - return m.normalize(path:sub(pos + 1)):gsub('^[/\\]+', ''), true + return files.normalize(path:sub(pos + 1)):gsub('^[/\\]+', ''), true else - return m.normalize(path):gsub('^[/\\]+', ''), false + return files.normalize(path):gsub('^[/\\]+', ''), false end end @@ -539,11 +532,26 @@ function m.awaitReady(uri) end ---@param uri uri +---@return boolean function m.isReady(uri) local scp = scope.getScope(uri) return scp:get('ready') == true end +---@return boolean +function m.isAllReady() + local scp = scope.fallback + if not scp:get 'ready' then + return false + end + for _, folder in ipairs(scope.folders) do + if not folder:get 'ready' then + return false + end + end + return true +end + function m.getLoadingProcess(uri) local scp = scope.getScope(uri) ---@type workspace.loading diff --git a/test/completion/common.lua b/test/completion/common.lua index e0668ea3..8d23822a 100644 --- a/test/completion/common.lua +++ b/test/completion/common.lua @@ -1006,12 +1006,12 @@ t.<??> ]] { { - label = 'a.b.c', + label = "'a.b.c'", kind = define.CompletionItemKind.Field, textEdit = { start = 40002, finish = 40002, - newText = '["a.b.c"]', + newText = "['a.b.c']", }, additionalTextEdits = { { @@ -1032,12 +1032,12 @@ t. <??> ]] { { - label = 'a.b.c', + label = "'a.b.c'", kind = define.CompletionItemKind.Field, textEdit = { start = 40005, finish = 40005, - newText = '["a.b.c"]', + newText = "['a.b.c']", }, additionalTextEdits = { { @@ -1058,7 +1058,7 @@ t['<??>'] ]] { { - label = 'a.b.c', + label = "'a.b.c'", kind = define.CompletionItemKind.Field, textEdit = { start = 40003, @@ -1075,12 +1075,12 @@ z<??> ]] { { - label = 'z.b.c', + label = "'z.b.c'", kind = define.CompletionItemKind.Field, textEdit = { start = 20000, finish = 20001, - newText = '_ENV["z.b.c"]', + newText = "_ENV['z.b.c']", }, }, } @@ -1094,12 +1094,12 @@ z<??> ]] { { - label = 'z.b.c', + label = "'z.b.c'", kind = define.CompletionItemKind.Field, textEdit = { start = 20000, finish = 20001, - newText = '_G["z.b.c"]', + newText = "_G['z.b.c']", }, }, } diff --git a/test/crossfile/completion.lua b/test/crossfile/completion.lua index d613f621..113b0327 100644 --- a/test/crossfile/completion.lua +++ b/test/crossfile/completion.lua @@ -127,6 +127,37 @@ end TEST { { path = 'abc.lua', + content = [[ + ---@meta + + ---@class A + ---@field f1 integer + ---@field f2 boolean + + ---@type A[] + X = {} +]], + }, + { + path = 'test.lua', + content = [[ X[1].<??>]], + main = true, + }, + completion = { + { + label = 'f1', + kind = CompletionItemKind.Field, + }, + { + label = 'f2', + kind = CompletionItemKind.Field, + }, + } +} + +TEST { + { + path = 'abc.lua', content = '', }, { diff --git a/test/crossfile/infer.lua b/test/crossfile/infer.lua index 2f2c35ad..de29007b 100644 --- a/test/crossfile/infer.lua +++ b/test/crossfile/infer.lua @@ -110,3 +110,56 @@ end }, infer = 'V', } + +TEST { + { path = 'a.lua', content = [[ +X = 1 +X = true +]], }, + { path = 'b.lua', content = [[ +print(<?X?>) +]], }, + infer = 'integer', +} + +TEST { + { path = 'a.lua', content = [[ +---@meta +X = 1 +X = true +]], }, + { path = 'b.lua', content = [[ +print(<?X?>) +]], }, + infer = 'boolean|integer', +} + +TEST { + { path = 'a.lua', content = [[ +return 1337, "string", true +]], }, + { path = 'b.lua', content = [[ +local <?a?>, b, c = require 'a +]], }, + infer = 'integer', +} + +TEST { + { path = 'a.lua', content = [[ +return 1337, "string", true +]], }, + { path = 'b.lua', content = [[ +local a, <?b?>, c = require 'a +]], }, + infer = 'unknown', +} + +TEST { + { path = 'a.lua', content = [[ +return 1337, "string", true +]], }, + { path = 'b.lua', content = [[ +local a, b, <?c?> = require 'a +]], }, + infer = 'nil', +} diff --git a/test/diagnostics/common.lua b/test/diagnostics/common.lua index b91380b8..a1dbe819 100644 --- a/test/diagnostics/common.lua +++ b/test/diagnostics/common.lua @@ -2231,3 +2231,40 @@ mt.init = function () obj.x = 1 end ]] + +TEST [[ +---@class A +X = {} + +function <!X.f!>() end + +function <!X.f!>() end +]] + +TEST [[ +---@meta + +---@class A +X = {} + +function X.f() end + +function X.f() end +]] + +TEST [[ +---@class A +X = {} + +if true then + function X.f() end +else + function X.f() end +end +]] + +TESTWITH 'global-in-nil-env' [[ +local function foo(_ENV) + Joe = "human" +end +]] diff --git a/test/diagnostics/init.lua b/test/diagnostics/init.lua index 2d2374a5..827d4d08 100644 --- a/test/diagnostics/init.lua +++ b/test/diagnostics/init.lua @@ -27,7 +27,7 @@ local function founded(targets, results) end ---@diagnostic disable: await-in-sync -function TEST(script, ...) +function TEST(script) local newScript, catched = catch(script, '!') files.setText(TESTURI, newScript) files.open(TESTURI) @@ -47,6 +47,41 @@ function TEST(script, ...) end files.remove(TESTURI) + + return function (callback) + callback(origins) + end +end + +function TESTWITH(code) + return function (script) + local newScript, catched = catch(script, '!') + files.setText(TESTURI, newScript) + files.open(TESTURI) + local origins = {} + local results = {} + core(TESTURI, false, function (result) + if code ~= result.code then + return + end + results[#results+1] = { result.start, result.finish } + origins[#origins+1] = result + end) + + if results[1] then + if not founded(catched['!'] or {}, results) then + error(('%s\n%s'):format(util.dump(catched['!']), util.dump(results))) + end + else + assert(#catched['!'] == 0) + end + + files.remove(TESTURI) + + return function (callback) + callback(origins) + end + end end require 'diagnostics.common' diff --git a/test/diagnostics/type-check.lua b/test/diagnostics/type-check.lua index 908920b9..4abe5855 100644 --- a/test/diagnostics/type-check.lua +++ b/test/diagnostics/type-check.lua @@ -1117,6 +1117,127 @@ local B = "World" local x = A ]] +TEST [[ +local enum = { a = 1, b = 2 } + +---@type { [integer] : boolean } +local t = { + <![enum.a]!> = 1, + <![enum.b]!> = 2, + <![3]!> = 3, +} +]] + +TEST [[ +local x + +if X then + x = 'A' +elseif X then + x = 'B' +else + x = 'C' +end + +local y = x + +<!y!> = nil +]] +(function (diags) + local diag = diags[1] + assert(diag.message == [[ +已显式定义变量的类型为 `string` ,不能再将其类型转换为 `nil`。 +- `nil` 无法匹配 `string` +- 类型 `nil` 无法匹配 `string`]]) +end) + + +TEST [[ +---@type 'A'|'B'|'C'|'D'|'E'|'F'|'G'|'H'|'I'|'J'|'K'|'L'|'M'|'N'|'O'|'P'|'Q'|'R'|'S'|'T'|'U'|'V'|'W'|'X'|'Y'|'Z' +local x + +<!x!> = nil +]] +(function (diags) + local diag = diags[1] + assert(diag.message == [[ +已显式定义变量的类型为 `'A'|'B'|'C'|'D'|'E'...(+21)` ,不能再将其类型转换为 `nil`。 +- `nil` 无法匹配 `'A'|'B'|'C'|'D'|'E'...(+21)` +- `nil` 无法匹配 `'A'|'B'|'C'|'D'|'E'...(+21)` 中的任何子类 +- 类型 `nil` 无法匹配 `'Z'` +- 类型 `nil` 无法匹配 `'Y'` +- 类型 `nil` 无法匹配 `'X'` +- 类型 `nil` 无法匹配 `'W'` +- 类型 `nil` 无法匹配 `'V'` +- 类型 `nil` 无法匹配 `'U'` +- 类型 `nil` 无法匹配 `'T'` +- 类型 `nil` 无法匹配 `'S'` +- 类型 `nil` 无法匹配 `'R'` +- 类型 `nil` 无法匹配 `'Q'` +...(+13) +- 类型 `nil` 无法匹配 `'C'` +- 类型 `nil` 无法匹配 `'B'` +- 类型 `nil` 无法匹配 `'A'`]]) +end) + +TEST [[ +---@param v integer +---@return boolean +local function is_string(v) + return type(v) == 'string' +end + +print(is_string(3)) +]] + +TEST [[ +---@class SomeClass +---@field [1] string +-- ... + +---@param some_param SomeClass|SomeClass[] +local function some_fn(some_param) return end + +some_fn { { "test" } } -- <- diagnostic: "Cannot assign `table` to `string`." +]] + +TEST [[ +---@param p integer|string +local function get_val(p) + local is_number = type(p) == 'number' + return is_number and p or p +end + +get_val('hi') +]] + +TESTWITH 'param-type-mismatch' [[ +---@class Class +local Class = {} + +---@param source string +function Class.staticCreator(source) + +end + +Class.staticCreator(<!true!>) +Class<!:!>staticCreator() -- Expecting a waring +]] + +TESTWITH 'assign-type-mismatch' [[ +---@type string[] +local arr = { + <!3!>, +} +]] + +TESTWITH 'assign-type-mismatch' [[ +---@type (string|boolean)[] +local arr2 = { + <!3!>, -- no warnings +} +]] + config.remove(nil, 'Lua.diagnostics.disable', 'unused-local') config.remove(nil, 'Lua.diagnostics.disable', 'unused-function') config.remove(nil, 'Lua.diagnostics.disable', 'undefined-global') diff --git a/test/hover/init.lua b/test/hover/init.lua index 751299bb..e77d8c98 100644 --- a/test/hover/init.lua +++ b/test/hover/init.lua @@ -238,14 +238,14 @@ TEST [[ string.<?sub?>() ]] [[ -function string.sub(s: string, i: integer, j?: integer) +function string.sub(s: string|number, i: integer, j?: integer) -> string ]] TEST[[ ('xx'):<?sub?>() ]] -[[function string.sub(s: string, i: integer, j?: integer) +[[function string.sub(s: string|number, i: integer, j?: integer) -> string]] TEST [[ @@ -272,7 +272,7 @@ TEST [[ string.<?lower?>() ]] [[ -function string.lower(s: string) +function string.lower(s: string|number) -> string ]] @@ -490,7 +490,7 @@ local self: { id: integer = 1, remove: function, __index: table, - __name: string = "obj", + __name: string = 'obj', } ]] @@ -610,7 +610,7 @@ end local <?r?> = a(1) ]] [[ -local r: string = "a" +local r: string = 'a' ]] TEST[[ @@ -620,7 +620,7 @@ end local _, <?r?> = pcall(a, 1) ]] [[ -local r: string = "a" +local r: string = 'a' ]] TEST[[ @@ -633,7 +633,7 @@ local n: integer TEST[[ local <?x?> = '\a' ]] -[[local x: string = "\007"]] +[[local x: string = '\007']] TEST [[ local <?t?> = { @@ -827,9 +827,9 @@ local <?t?> = { ]] [[ local t: { - [1]: string = "aaa", - [2]: string = "bbb", - [3]: string = "ccc", + [1]: string = 'aaa', + [2]: string = 'bbb', + [3]: string = 'ccc', } ]] @@ -1712,13 +1712,13 @@ local <?t?> = { ]] [[ local t: { - x: string = "e", - y: string = "f", - ['z']: string = "g", - [10]: string = "d", - [1]: string = "a", - [2]: string = "b", - [3]: string = "c"|"h", + x: string = 'e', + y: string = 'f', + ['z']: string = 'g', + [10]: string = 'd', + [1]: string = 'a', + [2]: string = 'b', + [3]: string = 'c'|'h', } ]] @@ -1830,7 +1830,7 @@ local t = { local <?x?> = t[#t] ]] [[ -local x: string = "x" +local x: string = 'x' ]] TEST [[ @@ -1864,10 +1864,10 @@ local <?x?> = { ]] [[ local x: { - x: string = "", - y: string = "", - _x: string = "", - _y: string = "", + x: string = '', + y: string = '', + _x: string = '', + _y: string = '', } ]] @@ -2430,3 +2430,20 @@ local t: { ['y']: integer = 2, } ]] + +TEST [[ +local enum = { a = 1, b = 2 } + +local <?t?> = { + [enum.a] = true, + [enum.b] = 2, + [3] = {} +} +]] +[[ +local t: { + [1]: boolean = true, + [2]: integer = 2, + [3]: table, +} +]] diff --git a/test/references/all.lua b/test/references/all.lua index 9395df86..3c376c21 100644 --- a/test/references/all.lua +++ b/test/references/all.lua @@ -126,3 +126,16 @@ end local v1 = Master:foobar("", Dog) v1.<!eat!>() ]] + +TEST [[ +---@class A +A = {} + +function A:<~TestA~>() +end + +---@param param A +function TestB(param) + param:<!TestA!>() +end +]] diff --git a/test/references/common.lua b/test/references/common.lua index 484418ae..9cf128a7 100644 --- a/test/references/common.lua +++ b/test/references/common.lua @@ -231,3 +231,18 @@ local t2 t2.<!x!> = 1 ]] + +TEST [[ +---@alias lang 'en' | 'de' + +---@class A +local a + +---@type lang +a.test = 'en' + +---@class B +local b + +b.<?<!test!>?> = a.test +]] diff --git a/test/tclient/tests/change-workspace-folder.lua b/test/tclient/tests/change-workspace-folder.lua index abd385cb..a9b0e36a 100644 --- a/test/tclient/tests/change-workspace-folder.lua +++ b/test/tclient/tests/change-workspace-folder.lua @@ -98,4 +98,22 @@ lclient():start(function (client) assert(files.getState(rootUri .. '/ws1/test.lua') == nil) assert(files.getState(rootUri .. '/ws2/test.lua') == nil) assert(files.getState(rootUri .. '/ws3/test.lua') ~= nil) + + -- normalize uri + client:notify('workspace/didChangeWorkspaceFolders', { + event = { + added = { + { + name = 'ws2', + uri = rootUri .. '%2F%77%73%32'--[[/ws2]], + }, + }, + removed = {}, + }, + }) + + ws.awaitReady(rootUri .. '/ws2') + assert(files.getState(rootUri .. '/ws1/test.lua') == nil) + assert(files.getState(rootUri .. '/ws2/test.lua') ~= nil) + assert(files.getState(rootUri .. '/ws3/test.lua') ~= nil) end) diff --git a/test/tclient/tests/modify-luarc.lua b/test/tclient/tests/modify-luarc.lua index 240ae582..62d97a41 100644 --- a/test/tclient/tests/modify-luarc.lua +++ b/test/tclient/tests/modify-luarc.lua @@ -6,6 +6,7 @@ local jsonb = require 'json-beautify' local client = require 'client' local provider = require 'provider' local json = require 'json' +local config = require 'config' local configPath = LOGPATH .. '/modify-luarc.json' @@ -324,4 +325,53 @@ lclient():start(function (languageClient) } } })) + + ------------------------------- + -- merrge other configs -- + ------------------------------- + + util.saveFile(configPath, jsonb.beautify(json.createEmptyObject())) + + provider.updateConfig() + + config.add(nil, 'Lua.diagnostics.globals', 'x') + config.add(nil, 'Lua.diagnostics.globals', 'y') + + client.setConfig({ + { + action = 'add', + key = 'Lua.diagnostics.globals', + value = 'z', + } + }) + + assert(util.equal(jsonc.decode_jsonc(util.loadFile(configPath)), { + ['diagnostics.globals'] = { 'x', 'y', 'z' } + })) + + ------------------------------- + + util.saveFile(configPath, jsonb.beautify(json.createEmptyObject())) + + provider.updateConfig() + + config.prop(nil, 'Lua.runtime.special', 'kx', 'require') + config.prop(nil, 'Lua.runtime.special', 'ky', 'require') + + client.setConfig({ + { + action = 'prop', + key = 'Lua.runtime.special', + prop = 'kz', + value = 'require', + } + }) + + assert(util.equal(jsonc.decode_jsonc(util.loadFile(configPath)), { + ['runtime.special'] = { + ['kx'] = 'require', + ['ky'] = 'require', + ['kz'] = 'require', + } + })) end) diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua index 4fbefd48..bc70fbf4 100644 --- a/test/type_inference/init.lua +++ b/test/type_inference/init.lua @@ -178,7 +178,7 @@ TEST 'boolean' [[ <?x?> = a == b ]] -TEST 'integer' [[ +TEST 'unknown' [[ <?x?> = a << b ]] @@ -186,7 +186,7 @@ TEST 'integer' [[ <?x?> = 1 << 2 ]] -TEST 'string' [[ +TEST 'unknown' [[ <?x?> = a .. b ]] @@ -202,7 +202,7 @@ TEST 'string' [[ <?x?> = 'a' .. 1.0 ]] -TEST 'number' [[ +TEST 'unknown' [[ <?x?> = a + b ]] @@ -227,11 +227,11 @@ local a <?x?> = - a ]] -TEST 'integer' [[ +TEST 'unknown' [[ <?x?> = 1 + X ]] -TEST 'number' [[ +TEST 'unknown' [[ <?x?> = 1.0 + X ]] @@ -2416,7 +2416,7 @@ local <?z?> = f() TEST 'integer|table' [[ local function returnI() - return a + 1 + return 1 end local function f() @@ -2620,6 +2620,17 @@ end print(<?n?>) ]] +TEST 'integer' [[ +---@type integer? +local n + +if not n then + os.exit() +end + +print(<?n?>) +]] + TEST 'table' [[ ---@type table? local n @@ -4199,3 +4210,47 @@ x.y = nil print(<?y?>) ]] + +TEST 'function' [[ +function X() + <?Y?>() +end + +function Y() +end +]] + +TEST 'A_Class' [[ +---@class A_Class +local A = { x = 5 } + +function A:func() + for i = 1, <?self?>.x do + print(i) + end + + self.y = 3 + self.y = self.y + 3 +end +]] + +TEST 'number' [[ +---@type number? +local n +local <?v?> = n or error('') +]] + +TEST 'Foo' [[ +---@class Foo +---@operator mul(Foo): Foo +---@operator mul(Bar): Foo +---@class Bar + +---@type Foo +local foo + +---@type Foo|Bar +local fooOrBar + +local <?b?> = foo * fooOrBar +]] diff --git a/theme-tokens.md b/theme-tokens.md index 1bde2199..44ed3720 100644 --- a/theme-tokens.md +++ b/theme-tokens.md @@ -1,46 +1,46 @@ ## Syntax Tokens -Provide by custom [tmLanguage file](https://github.com/sumneko/lua.tmbundle/blob/master/lua.tmLanguage.json), which is included by default in Visual Studio Code. +Provide by custom [tmLanguage file](https://github.com/LuaLS/lua.tmbundle/blob/master/lua.tmLanguage.json), which is included by default in Visual Studio Code. Preview in `Dark+` of VSCode | token | preview | | :---- | :---- | -| `keyword.local.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/keyword.local.lua.jpg?raw=true) | -| `keyword.control.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/keyword.control.lua.jpg?raw=true) | -| `entity.name.class.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/entity.name.class.lua.jpg?raw=true) | -| `entity.name.function.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/entity.name.function.lua.jpg?raw=true) | -| `punctuation.definition.parameters.begin.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/punctuation.definition.parameters.begin.lua.jpg?raw=true) | -| `punctuation.definition.parameters.finish.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/punctuation.definition.parameters.finish.lua.jpg?raw=true) | -| `variable.parameter.function.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/variable.parameter.function.lua.jpg?raw=true) | -| `punctuation.separator.arguments.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/punctuation.separator.arguments.lua.jpg?raw=true) | -| `constant.numeric.integer.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/constant.numeric.integer.lua.jpg?raw=true) | -| `constant.numeric.float.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/constant.numeric.float.lua.jpg?raw=true) | -| `constant.numeric.integer.hexadecimal.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/constant.numeric.integer.hexadecimal.lua.jpg?raw=true) | -| `constant.numeric.float.hexadecimal.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/constant.numeric.float.hexadecimal.lua.jpg?raw=true) | -| `punctuation.definition.string.begin.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/punctuation.definition.string.begin.lua.jpg?raw=true) | -| `punctuation.definition.string.end.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/punctuation.definition.string.end.lua.jpg?raw=true) | -| `string.quoted.single.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/string.quoted.single.lua.jpg?raw=true) | -| `string.quoted.double.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/string.quoted.double.lua.jpg?raw=true) | -| `string.quoted.other.multiline.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/string.quoted.other.multiline.lua.jpg?raw=true) | -| `constant.character.escape.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/constant.character.escape.lua.jpg?raw=true) | -| `constant.character.escape.byte.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/constant.character.escape.byte.lua.jpg?raw=true) | -| `constant.character.escape.unicode.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/constant.character.escape.unicode.lua.jpg?raw=true) | -| `invalid.illegal.character.escape.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/invalid.illegal.character.escape.lua.jpg?raw=true) | -| `punctuation.definition.comment.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/punctuation.definition.comment.lua.jpg?raw=true) | -| `comment.line.double-dash.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/comment.line.double-dash.lua.jpg?raw=true) | -| `punctuation.definition.comment.begin.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/punctuation.definition.comment.begin.lua.jpg?raw=true) | -| `punctuation.definition.comment.end.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/punctuation.definition.comment.end.lua.jpg?raw=true) | -| `comment.block.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/comment.block.lua.jpg?raw=true) | -| `keyword.control.goto.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/keyword.control.goto.lua.jpg?raw=true) | -| `string.tag.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/string.tag.lua.jpg?raw=true) | -| `punctuation.section.embedded.begin.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/punctuation.section.embedded.begin.lua.jpg?raw=true) | -| `punctuation.section.embedded.end.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/punctuation.section.embedded.end.lua.jpg?raw=true) | -| `variable.language.self.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/variable.language.self.lua.jpg?raw=true) | -| `support.function.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/support.function.lua.jpg?raw=true) | -| `support.function.library.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/support.function.library.lua.jpg?raw=true) | -| `keyword.operator.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/keyword.operator.lua.jpg?raw=true) | -| `variable.other.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/variable.other.lua.jpg?raw=true) | +| `keyword.local.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/keyword.local.lua.jpg?raw=true) | +| `keyword.control.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/keyword.control.lua.jpg?raw=true) | +| `entity.name.class.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/entity.name.class.lua.jpg?raw=true) | +| `entity.name.function.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/entity.name.function.lua.jpg?raw=true) | +| `punctuation.definition.parameters.begin.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/punctuation.definition.parameters.begin.lua.jpg?raw=true) | +| `punctuation.definition.parameters.finish.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/punctuation.definition.parameters.finish.lua.jpg?raw=true) | +| `variable.parameter.function.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/variable.parameter.function.lua.jpg?raw=true) | +| `punctuation.separator.arguments.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/punctuation.separator.arguments.lua.jpg?raw=true) | +| `constant.numeric.integer.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/constant.numeric.integer.lua.jpg?raw=true) | +| `constant.numeric.float.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/constant.numeric.float.lua.jpg?raw=true) | +| `constant.numeric.integer.hexadecimal.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/constant.numeric.integer.hexadecimal.lua.jpg?raw=true) | +| `constant.numeric.float.hexadecimal.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/constant.numeric.float.hexadecimal.lua.jpg?raw=true) | +| `punctuation.definition.string.begin.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/punctuation.definition.string.begin.lua.jpg?raw=true) | +| `punctuation.definition.string.end.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/punctuation.definition.string.end.lua.jpg?raw=true) | +| `string.quoted.single.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/string.quoted.single.lua.jpg?raw=true) | +| `string.quoted.double.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/string.quoted.double.lua.jpg?raw=true) | +| `string.quoted.other.multiline.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/string.quoted.other.multiline.lua.jpg?raw=true) | +| `constant.character.escape.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/constant.character.escape.lua.jpg?raw=true) | +| `constant.character.escape.byte.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/constant.character.escape.byte.lua.jpg?raw=true) | +| `constant.character.escape.unicode.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/constant.character.escape.unicode.lua.jpg?raw=true) | +| `invalid.illegal.character.escape.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/invalid.illegal.character.escape.lua.jpg?raw=true) | +| `punctuation.definition.comment.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/punctuation.definition.comment.lua.jpg?raw=true) | +| `comment.line.double-dash.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/comment.line.double-dash.lua.jpg?raw=true) | +| `punctuation.definition.comment.begin.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/punctuation.definition.comment.begin.lua.jpg?raw=true) | +| `punctuation.definition.comment.end.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/punctuation.definition.comment.end.lua.jpg?raw=true) | +| `comment.block.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/comment.block.lua.jpg?raw=true) | +| `keyword.control.goto.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/keyword.control.goto.lua.jpg?raw=true) | +| `string.tag.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/string.tag.lua.jpg?raw=true) | +| `punctuation.section.embedded.begin.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/punctuation.section.embedded.begin.lua.jpg?raw=true) | +| `punctuation.section.embedded.end.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/punctuation.section.embedded.end.lua.jpg?raw=true) | +| `variable.language.self.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/variable.language.self.lua.jpg?raw=true) | +| `support.function.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/support.function.lua.jpg?raw=true) | +| `support.function.library.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/support.function.library.lua.jpg?raw=true) | +| `keyword.operator.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/keyword.operator.lua.jpg?raw=true) | +| `variable.other.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/variable.other.lua.jpg?raw=true) | ## Semantic Tokens @@ -48,10 +48,10 @@ Preview in `Dark+` of VSCode | semantic token | fallen syntax token | preview | | :---- | :---- | :---- | -| `namespace.static` | `support.function.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/namespace.static.jpg?raw=true) | -| `namespace.readonly` | `constant.language.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/namespace.readonly.jpg?raw=true) | -| `namespace.deprecated` | `entity.name.label` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/namespace.deprecated.jpg?raw=true) | -| `parameter.declaration` | `variable.parameter` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/parameter.declaration.jpg?raw=true) | -| `property.declaration` | `entity.other.attribute` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/property.declaration.jpg?raw=true) | -| `variable` | `variable.other.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/variable.jpg?raw=true) | -| `interface.declaration` | `entity.name.function.lua` | ![avatar](https://github.com/sumneko/vscode-lua/blob/master/images/tokens/interface.declaration.jpg?raw=true) | +| `namespace.static` | `support.function.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/namespace.static.jpg?raw=true) | +| `namespace.readonly` | `constant.language.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/namespace.readonly.jpg?raw=true) | +| `namespace.deprecated` | `entity.name.label` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/namespace.deprecated.jpg?raw=true) | +| `parameter.declaration` | `variable.parameter` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/parameter.declaration.jpg?raw=true) | +| `property.declaration` | `entity.other.attribute` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/property.declaration.jpg?raw=true) | +| `variable` | `variable.other.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/variable.jpg?raw=true) | +| `interface.declaration` | `entity.name.function.lua` | ![avatar](https://github.com/LuaLS/vscode-lua/blob/master/images/tokens/interface.declaration.jpg?raw=true) | diff --git a/tools/configuration.lua b/tools/configuration.lua index b152927f..10bf6e08 100644 --- a/tools/configuration.lua +++ b/tools/configuration.lua @@ -32,8 +32,10 @@ local function getDefault(temp) if default == nil and temp.hasDefault then default = json.null end - if type(default) == 'table' and getType(temp) == 'object' then - setmetatable(default, json.object) + if type(default) == 'table' + and not next(default) + and getType(temp) == 'object' then + default = json.createEmptyObject() end return default end diff --git a/tools/love-api.lua b/tools/love-api.lua index 767a66c3..322393bf 100644 --- a/tools/love-api.lua +++ b/tools/love-api.lua @@ -137,7 +137,7 @@ local function buildDocFunc(variant, overload) params[#params+1] = '...' else if param.name:find '^[\'"]' then - params[#params+1] = ('%s%s: %s|%s'):format(param.name, getOptional(param), getTypeName(param.type), param.name) + params[#params+1] = ('%s%s: %s|%s'):format(param.name:sub(2, -2), getOptional(param), getTypeName(param.type), param.name) else params[#params+1] = ('%s%s: %s'):format(param.name, getOptional(param), getTypeName(param.type)) end diff --git a/tools/lovr-api.lua b/tools/lovr-api.lua index 4c4831fb..573eea9e 100644 --- a/tools/lovr-api.lua +++ b/tools/lovr-api.lua @@ -132,7 +132,7 @@ local function buildDocFunc(variant, overload) params[#params+1] = '...' else if param.name:find '^[\'"]' then - params[#params+1] = ('%s%s: %s|%s'):format(param.name, getOptional(param), getTypeName(param.type), param.name) + params[#params+1] = ('%s%s: %s|%s'):format(param.name:sub(2, -2), getOptional(param), getTypeName(param.type), param.name) else params[#params+1] = ('%s%s: %s'):format(param.name, getOptional(param), getTypeName(param.type)) end |