how do I make sublime recognize a javascript library - javascript

I have Javascript libraries downloaded in different folders, how do I set the path for them to be picked up by sublime. (and hopefully also show autocomplete for them)
I believe the right way to get the library into a js file is this:
var highcharts = require('highcharts');
Neither does it pick up the library nor does it do any autocomplete.
I've had problems with Emmet (same as the one mentioned here https://github.com/sergeche/emmet-sublime/issues/129) so I have the following plugins installed:
Javascript Next
Javascript Completions
SublimeCodeintel
SublimeLinter-jshint
For the autocompletions I've already asked a question (https://stackoverflow.com/questions/29079474/get-autocomplete-for-new-javascript-libraties-in-sublime) but the problem I want to get solved here is getting the library recognized and thereby suggest autocomplete.
Thanks.

Try All Autocomplete plugin, it finds matches in all open files of the current window.

Related

How to implement plugins into Electron app?

I'm looking for a way to implement "Plugins" for my Electron tool.
Below is a pseudo example of how I'm thinking it would work
Supply .js/.zip/plugin file
File would contain name of plugin, and it's category (Global, Team centric, Misc)
File would contain HTML for the GUI, which get's placed in a div designated for tool space. This name would be added as an option to the necessary Select, as well as logic added to pull in the HTML to the same div
In the tool, select the plugin file:
page will load the JavaScript script, and add option to select along with logic to switch to the plugin
The hope is to automate my current process.
Currently I'm manually updating the index page to reference the new JavaScript script, and to add the option on the select
The JavaScript Script has logic in it looking at the Select, and looking to see if the option was selected
which then pulls in it's own HTML via a function within
Is there anything I can reference/utilize to make this work?
After 4+ months of working on this, I've managed to get this to work. I will try to outline my approach.
Each "plugin" or "tool" will need it's own .js file
the js file should contain an exports.html function that will return the html for the tool
the js file should contain an exports.Events function that adds all relevant event listeners
create a json file cataloging each tool, along with information needed i.e. a description, image path, .js file path, etc.
require the .js file when selected, load the html and the events
parse the json to figure out which tool to load along with needed info
all i need to do is update the json file and upload the .js file to add a new plugin.
I developed an electron app using vue as the front-end.
My idea was to develop plugins as vue plugins and publish via npm.
I used live-plugin-manager to install and uninstall plugins.
The dependencies were automatically removed by making use of a counter
The only problem I faced was how to load these installed plugins into my main app.
The workaround I found was posted as answer to my own question at How to use electron to load the vue plugins installed dynamically into a plugins folder
Hope it helps
I know I'm a little late to the party but I encountered the same problem. To solve it I have built a plugin framework for Electron called Pluggable Electron and it is available on npm.
The framework handles the lifecycle of plugins, provides as npm packages, like installation, activation, removal, etc. The plugins can then be called on at any time to exend the core app functionality.
The framework is still under development but you can find a 1st version here: pluggable-electron.
I expect it is too late for Marker but still answering here for anyone else that might have this question.

build `remarkjs` without `highlighterjs`

I am already using highlighterjs and would rather use the externally included highlighter(js and css) and build a version of remarkjs that is much smaller. I can't figure out how to accomplish this. The included make.js file is supposed to build the highlighter only if the highlighter target is explicitly specified, but seems to automatically include it even if not specified. Suggestions?
See https://github.com/gnab/remark/wiki/Contributing#building for instructions on how to build remarkjs without the highlighting library, and still use it with an externally included library for highlighting code.

jQuery UI breaks Visual Studio 2015 Intellisense

I am finding a frustrating issue with JavaScript intellisense where if I include jQuery UI in my _references.js file I lose all JavaScript intellisense. Does anyone know if there is a way to fix this problem beyond removing jQuery UI from the _references.js?
Update
I do know that more files in the _references.js file will cause it to slow down, that makes sense. However, I have projects at work which include far more files (on the order of 600) with no typesense issues, and my project has 20. So it's not a matter of "too many files."
I pulled my project from Git to a separate computer (therefore separate installation of VS15) and tried including the jQuery UI file and this still caused the loss of intellisense in my project.
It can't be an installation issue since other work projects include jQuery UI and there are no intellisense issues
I do realize that I can manually manage _references.js to accomplish the task, but I would like to fix it altogether since I hate needing to add information twice (create the JS file and then update _refernces.js).
With this new information, I'm thinking it must be some type of deeper issue in my project's setup that is causing the issue as opposed to an installation based issue or jQuery UI specific issue. Does anyone have any ideas on what settings in a .sln or .csproj file might cause JS Intellisense issues?
For those who experience this issue, I found that using jQuery 3.x was causing instellisense to break when jQuery UI was included in _references.js. My solution was using NuGet to change back to version 2.2.4 and everything started to work fine again.
I've got the same problem. I tried quite a few things but the only thing I could get to consistently work was to disable the auto sync feature and remove the jquery UI reference.
Intellisense also seems to slow down a good bit with more and more libraries, almost to the point it looks like it is not working.
I finally just got to the point where I only include my own scripts and jquery for helpful reminders on syntax.
Unfortunately this means I have to manually keep the _references.js file up to date but it's definitely better than it not working at all.
You can also limit your global references in the _references file and drag the script files that you want intellisense for to each view if you are like me where you have a script file for each view. That way you don't get intellisense for scripts that aren't even rendered to the view.
not sure if this will help you but have you added this to the top of your .js file?
/// <reference path="/scripts/jquery-3.1.1.js" />
that's the path that's made if you you've used NuGet to install jquery for your solution. If you've located your jquery file and intellisense file elsewhere use that path instead (I do believe they need to be in the same folder).
I found a better solution! Simple rename jquery-ui-1.12.1.js (or similar) to _jquery-ui-1.12.1.js. This will cause it to appear at the top BEFORE the conflicting jQuery 3 references in the _references.js file that cause intellisense to not work. Be sure to also update any script tag or BundleConfig.cs references you have to include the new underscore character prefix!
Solution:
In your _references.js file:
Move the JQuery-UI reference above the main JQuery reference
Disable auto-sync
such as:
/// <autosync enabled="false" />
/// <reference path="jquery-ui-1.12.1.js" />
/// <reference path="jquery-3.3.1.js" />
Drawbacks:
You will have to repeat step 1 every time you Update JavaScript References (right-click on _references.js to update references in Visual Studio).
Always install jQuery first any version you like and then install JQuery-ui. If you want
to upgrade or degrade version of JQuery, you have to uninstall and again install JQuery-ui every time you do changes. First Jquery-3.6.0.js then Jquery-ui-1.12.1.js and you have to reinstall jquery-ui every time you make changes in jquery.

Should I put the version number of my JavaScript library in the file name?

I am about to release a javascript library.
I would like to save the file as [library-name].1.0.0
Then as the library will evolve you will be able to download new versions, e.g.
[library-name].1.0.1.js
[library-name].1.0.2.js
[library-name].1.0.3.js
[library-name].1.1.0.js
[library-name].1.2.0.js
[library-name].2.0.0.js
My question is: is there any reason not to save the version in the name of the file?
I am using other 3rd party libraries and the ones for which I don't store the version I always have to figure out if I have to upgrade or not.
For instance, I use codemirror.js, and I always wonder if I am using the latest version.
If you are giving it for download, then its a good idea to have version number as part of file name. Also its a good idea to add version number along with the license info at the beginning of the file like jQuery does
Checkout - http://code.jquery.com/jquery-1.9.1.min.js
Only case where you shouldn't add version number is when you are referencing a script file throughout your website - because you don't want to change all references whenever you update the script.
I've never released any libraries myself, but putting the version number in the file name sounds like a fine idea to me.
On upgrading, I think not putting the version number in the file name is used for libraries where the author doesn't expect to introduce breaking changes in future versions, only bug fixes and additions that don't affect code already written against the library. This means that people who use the library but don't host it themselves (i.e. who point to the library on a public CDN) automatically point to the latest version, and thus get bug fixes without having to do anything.
But, as you say, for people who download the library and host it themselves, it does mean they have to open the library file to check the version number.
If you want to match what some other library publishers do, you might want to have a look at Semantic Versioning - it codifies the x.x.x version numbering system.
And if you're going to release your library through Github (which I believe is what the cool kids do these days), you might want to use Jonathan "Wolf" Rentzsch's system for doing semantic versioning there.
If you are using unit tests you can make sure that the V1 unit tests all work fine against V2 before releasing the library.
Smashing article on js unit testing
If I understood your question correctly, one reason not to include the version name is that if you're hosting the script users using that CDN-hosted file don't have to change any code when you upgrade.

jQuery code assist in Aptana Studio 3.1.1

This is not duplicate question because lots of things changed in Aptana Studio 3.1.1 and there is no question regardnig that version.
I would like to have code assist for jQuery in Aptana Studio.
I already installed jQuery bundle. But I still don't get any code assist for my code.
I type for example:
$("div#chat").
After typing dot I should see list of all jQuery functions. But I don't see anything.
What I have to do to fix it?
It works for me as expected using the directions here:
Commands > Install Bundle > jQuery
Right click on a project, select Properties > Project Build Path and select the checkbox for jQuery 1.6.2.
If you don't do the second part, you'll just get snippets. This prevents you from needing to copy it into every project.
Got it fixed.
If you want to have code hinting for jquery you need to download (uncompressed) jQuery library and place it in the same folder as your script.
This is working but it is not satisfying me. I have many folders and I don't want to duplicate jQuery file over all folders.

Categories

Resources