Add a new code style on PhpStorm - coding-style

I have started using Semantic UI and I noticed that when I want to customize my css, I need to make .variables and .overrides files. Their syntax is just like .less syntax, but they're treated differently by their types.
What I want now, is when I open a .variables or a .overrides files, PhpStorm will treat it as a less code style. Is it possible to achieve it?
If there's an option to do per Project, it'll be perfect.

Related

Go text template syntax highlighting in GoLand

GoLand has syntax support on Go html files with the file extension of .gohtml
So what about Go text files? Does GoLand support that as well? .tmpl is supported by vim-go but not GoLand.
As mkopriva has already hinted and you have described as well in the comments, you can go to Preferences/Editor/File Types and add your custom ending as Registered pattern to the Go Template. But imo the real game changer is that you can also set Go as Template data language there. This way even the Go syntax gets validated, not just the template syntax. It's still wonky, but definitly better than nothing.
Still, autoformatting does not work properly and can screw up your code. Therefore, you might also want to make sure the Reformat code in the commit dialog is unchecked. Same with Optimize Imports ... better keep it unchecked.
there are two parts to this answer to get both html highlighting and go template highlighting
go template highlighting:
settings > editor > file types > select Go template files from the list > update pattern to the file ending you use for your go templates. I used *.go.html
html highlighting
settings > template data languages > project language (dropdown at the top) > set to html
now you have both html highlighting and go template completion

Is there an editor (or a solution for kate) doing syntax highlighting in a mixed code?

I'm using Kate as the editor of my Node.js projects. In the Node.js projects, I sometimes prefer to code whole index.html in a single file. At that time, I need to use:
html
css (<style>...</style>)
livescript (<script type="text/ls">...</script>)
javascript (<script [type="text/javascript"]>...</script>)
at the same time. Kate can highlight these codes if they are in their separate files.
How can I make the code highlighted correctly when they are mixed in a single file (preferably in Kate, or any other editor that would run on Linux)?
Kate can do this, too. It is supported in e.g. HTML/PHP highlighting and similar. Just have a look into the respective highlighting xml files to get an idea how to implement a highlighting for this. More information about how to write syntax highlighting files can be found in the KatePart Handbook.

What is the equivalent of re-formatting and checking syntax on save of Textmate in SublimeText2?

I recently switched to SublimeText2 from Textmate and I've been enjoying it.
But there are some features of Textmate which I don't know for SBT2.
Selecting a block of code and pressing CMD+OPTION+[ re-formats the selected block.
While saving a file CMD+S, ruby or jquery or coffee-script, etc.. Texmate checks the syntax of the code.
How to do the same with SBT2?
To check syntax on save you can use SublimeLinter and to reformat code you can use something like the following depending on what languages you work with:
HTMLTidy
Sublime-HTMLPrettify (HTML, JS, CSS)
Pretty JSON
PHPTidy
PythonTidy
BeautifyRuby
There are plenty of other similar and other useful extensions and plugins here: http://wbond.net/sublime_packages/community
All of which can be easily installed and kept up to date using Package Control.

Is there a way in Sublime Text 2 to support JavaScript completion of objects/functions defined in other files?

If I am editing a .js file in Sublime Text 2 that makes use of a library defined in a separate .js file, is there a way to support tab completion of objects/functions defined in the external library file?
Something analogous to the following from Visual Studio:
/// <reference path="/js/some-library.min.js" />
which enables IntelliSense over the library/plugin code.
I haven't tried it myself yet, but there's SublimeCodeIntel: https://github.com/Kronuz/SublimeCodeIntel#readme
The OP in this thread: http://www.sublimetext.com/forum/viewtopic.php?f=3&t=5319 seems to be complaining that it's pulling suggestions from outside the current file, which may mean it's doing what you want.
I was looking for the exact same thing, and I can confirm that SublimeCodeIntel works well. However, Sublime Text seems slightly less responsive when using SublimeCodeIntel, which is a drawback.
Another cool thing coming from a Visual Studio environment is the support for "Go to definition" in this plugin.
Another option is TernJS:
http://emmet.io/blog/sublime-tern/
I haven't yet used it, but it looks promising. Editor slowdown seems to be an issue with any code completion plugin; sounds like authors are still working out kinks in scraping and caching related files for code completion. The TernJS page addresses this issue and offers some config options for managing how it handles related files.

textmate bundles not recognizing differences

So i'm trying to make a set of grammars recognizing different file extensions properly.
All my files (js/css/html) end with template. This is similiar to how ruby does it with js.erb, css.erb, etc. So I modified the file type attribute to js.template css.template and template itself for html. But it doesn't seem to work. They just default to template even though there are more specific ones.
But for some reason Textmate doesn't want to recognize my different file extensions. Any idea why this would be happening or why the Ruby grammars seem to work but mine don't?
The detailed answer depends on the scope and therefore syntax highlighting you want. The general approach is as follows:
Open the Bundles Editor (Control-Meta-Command-B)
Search for the language definition of JavaScript, i.e. in the JavaScript bundle is a grammar definition called "JavaScript"
Open it and look for the line which starts with "filetypes", which should look like fileTypes = ( 'js', 'htc', 'jsx' );
Add your own file ending, i.e. "js.template"
Close the Bundle Editor or activate another snippet / command / grammar or click the Test button to reload the grammar (note that manual language definitions are preferred over file ending, so create a new file with that extension and load it with TextMate to make sure it works)
Repeat for any grammar definition you want to work with another file ending, i.e. HTML and CSS
This way you will have the default syntax highlighting working in your files with .template endings. However, the Ruby on Rails bundle extends those grammars a little, so maybe you want to extend the supported filetypes of these grammars as well.

Resources