ternjs / tern_for_sublime

Sublime Text package adding Tern support
MIT License
803 stars 54 forks source link

Still can't get autocomplete to work #145

Closed brw closed 7 years ago

brw commented 7 years ago

Tern.sublime-settings:

{
  "tern_argument_hints": true,
  "tern_argument_completion": true
}

Added this to Preferences.sublime-settings:

[
    {
        "characters": "<",
        "selector": "text.html"
    },
    {
        "characters": ".",
        "selector": "source.js"
    }
]

Installed packages:

"AdvancedNewFile",
"AutoPEP8",
"BracketHighlighter",
"Color Highlighter",
"DoxyDoxygen",
"Emmet",
"ESLint-Formatter",
"ExpandRegion",
"Git",
"GitGutter",
"Material Theme",
"Material Theme - Appbar",
"Missing Palette Commands",
"Package Control",
"SideBarEnhancements",
"Stylus",
"SublimeLinter",
"SublimeLinter-contrib-eslint",
"SublimeLinter-contrib-stylint",
"Sync Settings",
"SyncedSideBar",
"tern_for_sublime",
"Vue Syntax Highlight",
"zz File Icons"

Also tried adding a .tern-project file in my project root directory:

{
  "libs": [],
  "plugins": {
    "node": {}
  }
}

I have no idea what I could be doing wrong.

IvoVermeer commented 7 years ago

Try to do a simple test:

Start in an empty folder with a .tern-project file::

{
    "libs": [
        "browser"
    ]
}

and a new script file:

function testLog (string, object) {
  console.log(string);
  console.log(object)
}

test // <== should now autocomplete to 'testLog (fn/2), testLog (fn/1), etc'

If the above doesn't work and just to make sure none of the other packages are conflicting, backup your sublime User folder and remove all but Packagecontrol and tern_for_sublime from the Package Control.sublime-settings.

My setup is working fine, I have the following packages:

"AutoAligner",
"AutoFileName",
"Bootstrap 3 Snippets",
"DocBlockr",
"ESLint-Formatter",
"Git",
"HTML-CSS-JS Prettify",
"JavaScript Snippets",
"Markdown Preview",
"MarkdownEditing",
"npm",
"Package Control",
"PlainTasks",
"SideBarEnhancements",
"Sublime Tutor",
"SublimeLinter",
"SublimeLinter-contrib-eslint",
"tern_for_sublime",
"Theme - Soda"
brw commented 7 years ago

Ah, so it did work when I created a new folder in a new Sublime window, but for some reason it wouldn't work on an existing project. I added my existing project to the new window and now it works. Thanks!

IvoVermeer commented 7 years ago

No problem, you're welcome!