Is there a way to bulk format code in Sublime Text? - javascript

Is there a plugin, or setting in Sublime Text that will enable project-level code formatting and application of the .EditorConfig plugin?
I'm wondering specifically about manual application of .editorconfig preferences re-indenting multiple, deleting trailing whitespace, converting spaces to tabs, etc., across file types. To keep it basic, I'll limit my query to HTML, CSS/LESS/SASS, and JS.

There is no tool quite like this yet. There are some tools that almost do what you want. For example my not-yet-stable EditorConfig tools, eclint (not sure how stable this is), and codepainter (which works for JavaScript only).
An EditorConfig bulk reformatter would be great. If anyone finds one I didn't mention or wants to create a better one, you could probably find some help or moral support on the EditorConfig mailing list.

Haven't used editor config before, but a quick search led me to https://github.com/sindresorhus/editorconfig-sublime. Perhaps that plugin will do what you want.

Related

How to use localizations in SCEditor? (and general feedback & experiences)

I'm currently evaluating javascript based BBCode editors for a project.
The SCEditor seems to be realy great and got a lot of usefull features.
But can anyone tell me how to use the localizations? I could not find any localization files so I don't know if there are any prebuild languages existing or if i have to create them for my own, and in this case, how they have to look like.
I also could not find any documentation for this, there is just this hint the documentation.
And in general:
How are your experiances with this editor? And are there any other suggestions i maybe should have a look at?
In order to use the localization, that is actually all you need to do. Just include the correct .js localization file and that will be the localization that SCEditor will use for that webpage.
Have you tried doing that?

Using Aptana Studio for Extendscript

I've been using Sublime Text for creating the Javascript flavor of Extendscript scripts for our company. However, I've been curious about Aptana Studio and whether or not it might be a better choice to move to it. Already, however, I can see two big issues:
Handling Extendscript-specific code
Content assist using a DOM.
In the regular versions of Eclipse, if I wanted to use a specific piece of code from a library and get content assistance with it, I'd just add its .jar file to my build path and I was done. However, Javascript doesn't seem to use libraries, per se, so how would I get it to know the various methods and properties of a TextField object when I use the ol' Ctrl/Cmd+Space after typing in a reference to one, followed by a dot?
And at the beginning of my scripts, I have to use preprocessor directives, such as:
#target indesign;
#targetengine session;
so that the script knows what program I am using, if I want to #include other files, etc. These commands are, of course, specific to Extendscript, so when Aptana sees them, it breaks the Javascript syntax highlighting for the rest of the document. Is there any way to set Aptana to, perhaps, ignore preprocessor directives? Or add their syntax into its rules checking for syntax highlighting?
Also consider the ExtendScript Toolkit, if you haven't tried it yet. While it's not as powerful an editor, it does know about some of the DOM functions, and it has convenient built-in debugging tools for working with CC applications.

How do I find particular Javascript within my code

The problem is that I have a huge Javascript code, it's broken down into many files.
And I can't seem to find where a particular javascript code is .
How would you go about finding if you were in my place?
I have the firebug lite installed but no clue how to use it. Thank you.
P.S. I'm not able to comment on SO for some reason. Sorry.
Check out this link, specifically these headlines:
Find scripts easily
Many web applications are comprised of
quite a number of files, and finding
the one you want to debug can be a
chore. Firebug's script file chooser
sorts and organizes files into very
clean list that will help you find any
file in a snap.
Go directly to line 108, do not pass go
Often times you want to jump directly
to a specific line of your script.
Doing this couldn't be easier, just
type the line number into the quick
search box, preceded by the pound
sign, as seen in the screen shot on
the right.
Find scripts: Search scripts:
I would use a text editor with a Find In Files option like Notepad++. Most IDEs would also provide this search option.
there's always: grep -r 'function myHardtoFindFunction(' src/
on a unix system or another system with GNU utilities.
you can search for function names in the firebug search box, which will also search across multiple js files
just open firebug and on the right hand side should be a searchbox. there are even check boxes for searching multiple files, case insensitivity and the use of regex if you feel ambitious.

How to add Rich Text Editor to display code snippets

Im working on a Rails based application where I have the need to allow the user to format the text he enters and I would also like a way to highlight code snippets the way Stackoverflow does when I enter a code snippet.
Are there any plugins that do this.
And I would also like to know which is the RTE that is recommended and would be unobtrusive.
I see a lot of recommendations for FCKEditor but how do I implement the code snippets?
It seems like you might need something lighterweight than CKeditor. If you do choose to use CKeditor, I would use a rails plugin to install it. I use this one :
http://github.com/galetahub/rails-ckeditor
The directions are very straightforward on the git.
As for Syntax Highlighting , I recommend :
The GitHub crew loves Pygments. They are using it on many different places, including Jekyll and GitHub itself. The downside is that it's a python library so you would need to install python and execute it as a shell task.
Syntax Highlighter, jQuery Library <-- The easiest to implement
http://alexgorbatchev.com/SyntaxHighlighter/
Rails3 has these plugins :
Ruby offers 3 code highlighting Gems: Ultraviolet, Syntax and CodeRay. AFAIK, the last one is the most adopted.

Javascript intellisense with Dojo/Dijit is Visual Studio 2008

I know that Visual Studio 2008 support JavaScript intellisense as I am using it with Jquery. I am wondering if anyone has ever explored how to get other libraries like Dojo and Dijit to work with it as well. I would assume you would have to provide the ///reference tag to your custom code but would still need a vsdoc for visual studio to look in.
Just curious if anyone has tried this or has any suggestions. I might have to hand roll the vsdoc, which might not be too hard based on the api.xml documentation. Thanks for the help!
There is no official Intellisense file for Dojo unfortunately. We could look up the spec and formulate something specific (like we do with Komodo .cix), it is just a matter of using the existing doc parser to scan over the code and generate whatever needs generated.
If you do hand-roll a vsdoc completion file, we'd love to have it. Or if you need any assistance using the doc parser to generate it feel free to contact me offlist (I'm 'dante' # the toolkit domain) and we can see about getting something out there.
We use Visual Assist plugin, and it does pretty well, only thing it lacks is list methods function because of the way you declare objects in Dojo with functions as property values, VA has trouble parsing these. Its OK with old school prototypes though.
They are not officially supported for VS2008, but you may be able to get them to work. Of course, they don't have any of the meta comments in them. If you get any errors, you can create a -vsdoc version of the library and try to edit it to get past the error messages.
JavaScript IntelliSense in VS2010 will be much more robust and you will be able to get good IntelliSense (again without the meta-data) on a much wider range of 3rd party libraries.

Categories