SublimeLaTeXWordCount icon indicating copy to clipboard operation
SublimeLaTeXWordCount copied to clipboard

Breaks when user settings are added

Open NathanJang opened this issue 9 years ago • 2 comments

I followed the advice on the default .sublime-settings and put this in my user configuration LaTeXWordCount.sublime-settings:

{
  "LaTeX": {
    "exclude_footnotes": false
  }
}

Then, when I run the word count, nothing appears to happen. This is printed on the console:

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 549, in run_
    return self.run(edit)
  File "WordCount in /Users/jonchan/Library/Application Support/Sublime Text 3/Installed Packages/LaTeX Word Count.sublime-package", line 142, in run
  File "WordCount in /Users/jonchan/Library/Application Support/Sublime Text 3/Installed Packages/LaTeX Word Count.sublime-package", line 89, in wordcount_latex
TypeError: 'NoneType' object is not iterable

I've also tried this with "exclude_abstract": false. This doesn't happen when the user config file is deleted, and appears to happen even if a blank file is present.

NathanJang avatar Mar 05 '15 14:03 NathanJang

Hmm the current version can't look up default values that are nested in other config elements, so as a workaround for now you could simply copy-paste the entire "LaTeX" configuration block and adjust the exclude-options in there, i.e. have this as your user package settings:

{
    "LaTeX": {
        "markup_commands": ["text\\w+", "uppercase", "uline", "emph", "caption"],
        "exclude_headers": false,
        "exclude_footnotes": false,
        "exclude_appendices": true,
        "exclude_abstract": false
    }
}

Please let me know if that works for you

lionandoil avatar Mar 05 '15 14:03 lionandoil

It does! Any ideas on how to fix it? I don't know Python, so I can't help.

NathanJang avatar Mar 05 '15 14:03 NathanJang