扩展Notepad ++中的Lua语言设置以对拼写检查也包含在[[... ...]]

时间:2019-01-10 21:19:03

标签: lua notepad++ spell-checking

我目前正在检查LaTeX's TikZ/PGF code的lua文件,除其他外,我想纠正拼写错误,因为这些lua文件的一部分也用于manual

为此,我使用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语言不熟悉。)当然,如果可能的话,怎么办?

2 个答案:

答案 0 :(得分:2)

我认为问题在于,当选择了突出显示语言样式时,用于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字符串文字的string属性。

答案 1 :(得分:1)

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