From fe5d329c4787fde7a8fec0e9f092537eb439a3b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 13 May 2021 16:12:29 +0800 Subject: [PATCH] fix #536 --- changelog.md | 1 + script/core/signature.lua | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index e1cff8c41..f7ec7aacb 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,7 @@ ## 1.21.2 * `FIX` loaded new file with ignored filename +* `FIX` [#536](https://github.com/sumneko/lua-language-server/issues/536) ## 1.21.1 `2021-5-8` diff --git a/script/core/signature.lua b/script/core/signature.lua index a35f35932..eb740784b 100644 --- a/script/core/signature.lua +++ b/script/core/signature.lua @@ -41,14 +41,17 @@ local function makeOneSignature(source, oop, index) label = label:gsub('%s*->.+', '') local params = {} local i = 0 - for start, finish in label + local argStart, argLabel = label:match '()(%b())' + local converted = argLabel + : sub(2, -2) : gsub('%b<>', function (str) return ('_'):rep(#str) end) - : gmatch '[%(%)%,]%s*().-()%s*%f[%(%)%,%[%]]' do + : gsub('[%[%]%(%)]', '_') + for start, finish in converted:gmatch '%s*()[^,]+()' do i = i + 1 params[i] = { - label = {start, finish-1}, + label = {start + argStart, finish - 1 + argStart}, } end -- 不定参数