1

If I have references to two external/custom JS script files inside my HTML, namely

<script type="text/javascript" src="xyz.com/xyz.js" type="text/javascript" />

or

<script type="text/javascript" src="js/xyz.js" type="text/javascript" />

I somehow cannot figure out how to use SublimeCodeIntel to work due to the lack of documentation. Could someone help me out here?

1 Answers1

1

There are a few ways you can get the intelligent code awareness and auto-completion, as answered here and in addition to that of you want your own auto-completions to work you can check sublime official docs for completion and completion files and you can use snippets too.

for example of manually creation of auto-complete suggestion create file myCompletion.sublime-completions:

{
        "scope": "text.html - source - meta.tag, punctuation.definition.tag.begin",

        "completions":
        [
                { "trigger": "a", "contents": "<a href=\"$1\">$0</a>" },
                { "trigger": "abbr", "contents": "<abbr>$0</abbr>" },
                { "trigger": "acronym", "contents": "<acronym>$0</acronym>" },

                "ninja",
                "robot",
                "pizza"
        ]
}
Community
  • 1
  • 1
Morteza Tourani
  • 3,506
  • 5
  • 41
  • 48
  • Is there no way that I can set the plugin to "also look" into the referenced JS file in a way that it automatically starts picking the functions in my intellisense? – Pramod Mohandas Jun 27 '16 at 12:14
  • @PramodMohandas There is no chance for unknown scripts unless you add it yourself. but code intel (and ternjs) does it for most of libraries. – Morteza Tourani Jun 27 '16 at 17:19
  • Yes, I'm OK to reference the script somewhere so that it starts picking it up. These JS files are third-party. Nothing that ST3 can do? – Pramod Mohandas Jun 28 '16 at 05:31
  • @PramodMohandas So that's the only way remains – Morteza Tourani Jun 28 '16 at 05:34
  • How do I do that referencing? I still couldn't figure it out. Adding them to the project files list? Does SublimeCodeIntel have this capability? – Pramod Mohandas Jun 28 '16 at 06:34
  • You have to define your project. Search for tern-for-sublime or codeintl to find out more. – Morteza Tourani Jun 28 '16 at 06:42
  • Looks like I'll have to drop ST3 and go with WebStorm. I was looking for a change in IDE for JS/CSS/HTML. I was trying to replicate this on ST3 - https://blog.jetbrains.com/webstorm/2014/07/how-webstorm-works-completion-for-javascript-libraries/ – Pramod Mohandas Jun 28 '16 at 08:01