How can I get HAML syntax styling to work in Sublime Text? - haml

I tried following the instructions but I've had no luck getting HAML to show up as an option in the Syntax list. I've got package control installed, I just don't know how to get the HAML in there.
I'm using Sublime Text 3.
Currently, I'm just using the Ruby Syntax instead which seems to be ok but the documents never remember that I picked that.

You need to install the Haml package with Package Control. Open the Command Palette (Tools -> Command Palette) and type in pci to bring up the Package Control: Install Package option. Hit Enter, and wait for the package list to load. Once loaded, type haml and select the first entry - it should say HAML Bundle for Textmate. Hit Enter, and watch the status bar at the bottom of the window until it prints a message about successfully installing the package. You can now select Ruby HAML from the list of syntaxes.

Related

.ejs files in Sublime default to file type "Plain Text"

I'm new to coding and I'm using the Express framework in Sublime.
When I create .ejs files, (for example footer.ejs) for some reason Sublime shows these files as Plain Text files, instead of .ejs files, even though I have NPM installed ejs.
Furthermore, when I click on "Plain text" in the bottom right of Sublime, EJS doesn't show up as an option.
My package.json shows that I have ejs installed: "ejs": "^2.5.9".
Does anyone know what I'm doing wrong? And how I can get .ejs files to automatically default to EJS instead of plain text? Thanks!
The short version of the answer to your question is that installing a package via npm doesn't have any effect on Sublime. In order to add support for EJS to Sublime you need to install a package for it in Sublime.
Package Control has a couple of packages, EJS and EJS 2 (and maybe also Hyperloop EJS, if that's a thing; I'm unfamiliar with EJS).
Just at first blush it seems like EJS 2 might be the better first bet; it's been more recently updated and is using the newer sublime-syntax syntax format and seems to support more things. Take that with a grain of salt though, since I have no experience with either one.
You can select the command Package Control: Install Package from the command palette and then select one of those packages to install it. If you're going to try them both, do it one at a time and use Package Control: Remove Package before installing the next one so that they don't compete with each other.
If those commands aren't in your command palette, you don't have Package Control installed yet. In that case you can select Install Package Control from the command palette to install PC first. If that doesn't work there are also instructions on how to install it manually.
Once you have a package installed, you can close and reopen the file to apply the correct syntax, or use the menu as you mention in your question.
Let's make it short and simple.
Syntax highlighting and auto completions are not great if you were to download ejs package.
Instead I recommend you to use html syntax highlighting.
Open Command pallet using ctrl+ shift + P or cmd + shift + P.
Set Syntax: HTML

VSCode Typescript.NPM Warning for Babylon.js TS File

I use VSCode as an IDE for Babylon.js. To show Babylon.js code hinting, I was recommended to use "babylon.d.ts" file as the value of the "typescript.npm" in the VSCode's User Settings.
But when I hovered over a property in my JS script, a warning came up:
Could not install typings files for JavaScript language features.
Please ensure that NPM is installed or configure 'typescript.npm'
in your user settings.
How to fix this error and show the code hinting for Babylon.js JS script on VSCode?
to get babylon.js typings, just drop the babylon.d.ts file in your folder.
The file will be used by VSCode compiler directly

Error Less2CSS plugin while compiling less file in Sublime Text 2

I installed Sublime Text 2 and Node.js.After that i install less with that command npm install -g less with command console.When i install Less2CSS plugin and try to compile less file then i am getting error The compress option has been deprecated. We recommend you use a dedicated css minifier, for instance see less-plugin-clean-css.I found the same issue on here also.But i didn't understand what and which file to change.please help me if anyone have same issue.I attached the screen shot for more understand the issue.Thank you everyone.
To fix this issue, go to Sublime Text and:
Go to Preferences > Browse Packages
Open the Less2css folder
Open the lesscompiler.py file in a text editor
Go to line 184 and change this
cmd = [lessc_command, less, css, "-x", "--verbose"]
to this
cmd = [lessc_command, less, css, "--clean-css", "--verbose"]
Save the file, restart Sublime Text, and attempt to save your LESS file again.
It means that the option is not supported. it recommend you use a dedicated css minifier.
You can change the option.
Via "Preferences" -> "Package Settings" -> "Less2Css" -> "Settings - Default".
change ["minify": true,] to ["minify": false,]
and then, if you want to minify the css file, please use a dedicated css minifier to do this.

WebStorm syntax highlighting for Swig template engine

Given:
The Swig template engine: http://paularmstrong.github.io/swig/
Webstorm has a plugin for it: Textmate bundles support
A Textmate bundle for Swig is available: https://github.com/paularmstrong/Swig.tmbundle
I expect I should be able to get Swig highlighting fixed, but I'm only getting half way.
Below is the resulted highlighting I get. The Swig code is highlighted as expected, but HTML is not highlighted anymore.
I've tried installing and enabling the HTML textmate bundle as well, but when both the HTML and the Swig bundle are activated, the code is highlighted as only HTML. If I disable the HTML bundle but have the Swig bundle still active, I only get Swig highlighting.
My Question: How do I get Swig code and HTML code highlighted in the same file in WebStorm on Windows?
Result:
This is my Textmate Bundles configuration in WebStorm 9:
Again, simply selecting the HTML bundle to enable it doesn't work.
Swig has nearly identical syntax to Twig, so we can assume they can be used interchangeably speaking of syntax highlighting and code completion.
The thing is that PHPStorm it has a Twig support throught a plugin (which is awesome BTW), but sadly it is not available in the others IDEs thought the Plugins menu.
This issue can be solved by:
manually downloading the plugin from the official repo at https://plugins.jetbrains.com/plugin/7303?pr=
then installing it manually thought the Plugin interface,
then or use the .twig extension on files or adding a new mapping in the File Types system menu for the type Twig, with wildcard *.html or *.swig, how you prefer.
I'm using the *.html workaround and work like a charm, both Swig & HTML syntax highlighting + code completion.
Hope this helps you like it did to me :)

How do I browse the source code for a gem in Rails3 with RVM (linux & gedit)

I am running rails3 in Ubuntu and using gedit for coding. I am using RVM. To look at the gem source code I tried: bundle open jquery-rails
That doesn't work since I hadn't setup an editor. After setting gedit as the editor it still doesn't work because gedit can't be passed directories. I guess it only works with files. Too bad :(.
nathan.f77's answer to this question ( Lookup Gem or Plugin code packaged in a Rails3 application ) seems promising, but I wasn't able to follow his instructions. They lacked sufficient detail for me.
What is a very easy way to browse the source files for gems that I am using in my rails3 app?
bundle show jquery-rails should tell you where the gem source lives on your filesystem. Then open the file that you want.
CubaLibre's response got me half-way there. The other piece of the puzzle I was able to get from Ask Ubuntu.
Here are the steps to browse gem code in gedit using Ubuntu.
a. From the command line run:
gnome-open $(bundle show [gem-name])
b. This will open up the gem directory in nautilus. From there just double click on file you'd like to see and it will open up in gedit.
Assuming you have a default editor set in your terminal, on MacOS you can do something like this example (atom is my editor, but should work with sublime or textmate, vim, etc.):
atom $(bundle show name_of_gem)