将 Notepad++ 中 Lua 语言设置扩展到拼写检查 `[[ ... ]]` 中的内容

我目前正在阅读 LaTeX 的 TikZ/PGF 代码中的 lua 文件,其中我想纠正拼写错误,因为其中一些 lua 文件还用于 手册

因此,我使用 Notepad++,但似乎用[[" ... "]]括起来的内容不会被拼写检查。这是来自 DistanceMatrix.lua文件的一个例子,我在其中引入了一个拼写错误。

declare {
  key = "distance matrix verticess",
  type = "string",

  summary = [["
    A list of verticess that are used in the parsing of the
    |distance matrix| key. If this key is not used at all, all
    vertices of the graph will be used for the computation of a
    distance matrix.
  "]],

在以下图像的左侧,当 Lua 是活动语言时,显示的结果,在右侧为 TeX 是活动语言时。

image showing the above code in Notepad++ when using languages Lua (left) and TeX (right)

如图所示,当 Lua 是活动语言时,在 summary 部分中的“verticess”一词没有下划线标记。

有可能将 Notepad++ 中的 Lua 语言扩展 / 修改,使其可以拼写检查 [[" ... "]] 中的内容吗?(也许仅检查 [[ ... ]] 内的内容,而不使用引号,这样就足够了吗?不幸的是,我对 Lua 语言不熟悉。)当然,如果这是可能的,如何操作?

点赞
用户8291949
用户8291949

我认为问题在于 Notepad++ 的 DSpellCheck 插件在选择高亮语言样式时不会检查 字符串字面量。这不仅发生在 Lua 中,也发生在其他语言中(例如C#和其@"multiline string literal")。可能没有简单的方法来修复这个问题。我建议与他们开个票。

一些指针:

Scintilla.h 中定义了

#define SCE_LUA_LITERALSTRING 8

在 DsSpellCheck 的 SpellChecker.cpp

if (category != SciUtils::StyleCategory::text && !((category == SciUtils::StyleCategory::comment && m_settings.check_comments) ||
  (category == SciUtils::StyleCategory::string && m_settings.check_strings) ||
  (category == SciUtils::StyleCategory::identifier && m_settings.check_variable_functions))) {

但是,Scintilla 可能无法正确公开 Lua 字符串文字的字符串属性。

2019-01-11 07:08:12
用户7396148
用户7396148

TeX 在语言风格的定义上有些作弊。TeX 的定义能够识别变量名中的拼写错误:enter image description here

这可能会对许多人造成麻烦。

如果这对您的需求是可接受的,您可以使用 DSpellCheck 的较旧版本(1.3.5 或更早版本),取消选中 DSpellCheck 的 Check Only Comments and Strings if Possible 设置,以将此行为应用于所有语言:

enter image description here


更改后的 Lua 语言设置示例: enter image description here

2019-01-11 16:00:24