SublimeText / LaTeXTools

LaTeX plugin for Sublime Text
https://latextools.readthedocs.io/
2.01k stars 367 forks source link

User settings are ignored #1031

Open jagmoreira opened 7 years ago

jagmoreira commented 7 years ago

I'm running MacOS Sierra 10.12.3, ST3 Build 3126, and the latest version of LaTeXTools.

It seems my LaTeXTools User settings are being ignored. I noticed it when I as trying to set up Preview as the pdf viewer:

{
    "viewer": "preview"
}

This didn't seem to work. From the logs:

<class '_latextools_skim_viewer.SkimViewer'>
Running "osascript -e 'POSIX path of (path to app id "net.sourceforge.skim-app.skim")'"
Traceback (most recent call last):
(....)
subprocess.CalledProcessError: Command '['osascript', '-e', 'POSIX path of (path to app id "net.sourceforge.skim-app.skim")']' returned non-zero exit status 1

Then I tried a longer form:

{
    "viewer": "command",
    "viewer_settings": {
        "OSX": {
            "view_command": "open -a Preview $pdf_file"
        }
    }
}

But I got the same error message.

Did a System Check and no important programs seem to be missing:

Variable   Value
--------   -----
PATH       /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/TeX/texbin:/Library/TeX/texbin:/usr/texbin:/usr/local/bin:/opt/local/bin
(omitted other variables for clarity)

Program      Location                       Status     Version
-------      --------                       ------     -------
latexmk      /Library/TeX/texbin/latexmk    available  Latexmk, John Collins, 17 Jan. 2017. Version 4.52b
pdflatex     /Library/TeX/texbin/pdflatex   available  pdfTeX 3.14159265-2.6-1.40.17 (TeX Live 2016)
xelatex      /Library/TeX/texbin/xelatex    available  XeTeX 3.14159265-2.6-0.99996 (TeX Live 2016)
lualatex     /Library/TeX/texbin/lualatex   available  This is LuaTeX, Version 0.95.0 (TeX Live 2016)
biber        None                           missing    unavailable
bibtex       /Library/TeX/texbin/bibtex     available  BibTeX 0.99d (TeX Live 2016)
bibtex8      None                           missing    unavailable
kpsewhich    /Library/TeX/texbin/kpsewhich  available  kpathsea version 6.2.2
magick       /usr/local/bin/magick          available  ImageMagick 7.0.4-10 Q16 x86_64 2017-02-18 http://www.imagemagick.org
ghostscript  /usr/local/bin/gs              available  GPL Ghostscript 9.20 (2016-09-26)

Packages for equation preview  Status
-----------------------------  ------
standalone                     missing
preview                        missing
xcolor                         available
amsmath                        available
amssymb                        available
latexsym                       available
mathtools                      available

Builder      Status
-------      ------
traditional  available

Builder Setting  Value
---------------  -----
display_log      False
linux            {}   
osx              {}   
windows          {}   

LaTeX Engine
------------
pdflatex    

Viewer  Status   Location
------  ------   --------
skim    missing  N/A

As you can see the system keeps using skim as the viewer.

Finally, I tried playing around with my user settings to see if any changes occurred. Here's my current user settings:

{
    "builder_settings" : {
        "display_log" : true,
    },
    "preview_image_mode": "none",
    "viewer": "command",
    "viewer_settings": {
        "OSX": {
            "view_command": "open -a Preview $pdf_file"
        }
    }
}

However the System Check looks exactly like what I pasted above, i.e., build logs display set to False, viewer set to skim. Note that, despite me explicitly turning it off, image previews are still being displayed.

I should also say that I tried the "Reset the user settings to default" trick a few times, and removing and reinstalling LaTeXTools. No change.

Any ideas?

r-stein commented 7 years ago

If you reset the user settings to default there should be content in your user settings. How do you open them?

jagmoreira commented 7 years ago

Yes there is content when I first reset user settings. I then only kept the settings for which I changed the value from the default ones. I figured the plugin reads any missing settings from the default file.

I just reset the settings again and this time left all the content that I did not want to change. The user settings still seems to be ignored. FYI, this is file I'm editing:

/Users/<username>/Library/Application Support/Sublime Text 3/Packages/User/LaTeXTools.sublime-settings
r-stein commented 7 years ago

You are free to remove the content. Can you open the ST console ctrl+` and write from LaTeXTools.latextools_utils import get_setting and then get_setting("viewer"). This should print your viewer.

jagmoreira commented 7 years ago

Nope, it's not picking up my changes:

>>> from LaTeXTools.latextools_utils import get_setting
>>> get_setting("viewer")
''
r-stein commented 7 years ago

Also try sublime.load_settings("LaTeXTools.sublime-settings").get("viewer") and view.settings().get("viewer")

jagmoreira commented 7 years ago

First one is empty, second is None:

>>> sublime.load_settings("LaTeXTools.sublime-settings").get("viewer")
''
>>> view.settings().get("viewer")
r-stein commented 7 years ago

That's weird. Do your settings work in other packages?

jagmoreira commented 7 years ago

Just tested it. All my other user settings (including Sublime's own settings) are working as expected.

r-stein commented 7 years ago

I don't understand how this happens. You can try to write sublime.load_settings("LaTeXTools.sublime-settings").set("viewer", "preview") and check what is happening, but this is not really a solution.

Tyde commented 7 years ago

I do have a similar problem. LaTeXTools seems to ignore my "builder" setting. When I set my builder to "simple" In my LaTeXTools System Check it displays it correctly as simple, but it will always use the TraditionalBuilder.

If I check the loaded settings with get_settings("builder") it does however show the correct builder settings from my User settings file.

ig0774 commented 7 years ago

@Tyde: That actually has a somewhat different cause. It's a result of the builder variants available, which ultimately have the ability to override settings. Just use C-shift-B and select the LaTeX variant and your settings will be honoured.

As I note, I wouldn't recommend using the "simple" builder. Please use the "basic" builder instead.

stephenlevitt commented 7 years ago

Just been bitten with this with respect to the: "aux_directory" setting. One project was using this setting correctly, while another was ignoring it. Using C-shift-B on the project ignoring the setting, and choosing the correct builder solved the issue.

jklaise commented 7 years ago

I have just encountered this on Arch Linux with ST3 Build 3126 and latest LatexTools. None of my changes done to the User config apply, I have to edit the read-only default settings for changes to apply.