isruslan / vim-es6 Goto Github PK
View Code? Open in Web Editor NEWList of JavaScript ES6 snippets and syntax highlighting for vim.
Home Page: http://www.vim.org/scripts/script.php?script_id=5230
List of JavaScript ES6 snippets and syntax highlighting for vim.
Home Page: http://www.vim.org/scripts/script.php?script_id=5230
JavaScriptFold()
in the source, however vim tells me No fold found
when I type zc
in a foldable block~/.vimrc
, it seems to work:" From vim-es6 source:
setl foldmethod=syntax
setl foldlevelstart=1
syntax region foldBraces start=/{/ end=/}/ transparent fold keepend extend
~/.vimrc
?First of all, thank you for this plugin!
I have a suggestion for highlighting in objects. As it stands, everything is purple except non-string keys:
The problem becomes especially apparent when the object keys are also strings, as they become the same colour as everything else.
It would be great if the highlighting somehow differentiated between keys, literals (true
, false
, 10
, 4.2
), and strings. For example, the default highlighting "solves" this problem by simply ignoring numbers:
An even better solution would be greatly appreciated, though.
Hey thanks for writing this, so far it works quite well. I noticed the example gif in your README has been committed directly to git. Since the file is 4MB, it makes cloning the repo a lot slower than it needs to be, particularly over coffee shop wifi. You may want to consider hosting the image somewhere external and just linking to it from the README so it doesn't need to live in source control and bloat the repo.
Example:
if (1)
{
echo 'foo';
}
I expect this to indent as:
if (1)
{
echo 'foo';
}
It appears to handle the bracket inline just fine though:
if (1) {
echo 'foo';
}
Example:
let foo = (( 1+
2)
)
let bar = 3;
I would expect this to be:
let foo = (( 1+
2)
)
let bar = 3;
or this (possible configurable):
let foo = (( 1+
2)
)
let bar = 3;
It seems comments are not being aded to the HI Comment group?
Example:
// Single Line Slashed Comment
--> Single Line Arrow Comment
I would think these should both be the same color using your plugin?
Nice work BTW! Thanks for the effort. ES6 is definitely a nicer experience with your plugin enabled.
The grammar for RegExp literals in ES6 allows /
to appear without a preceding \
in character class expressions (see RegularExpressionClassChar
in the grammar). However, vim-es6 highlights such expressions incorrectly. For example, in the following:
/foo[/]bar/
vim-es6 does not highlight ]bar/
as part of the regular expression.
Note that this is made more significant by the the ESLint no-useless-escape rule (which is enabled by popular configurations such as the airbnb config) which produces a warning when \
is added.
Thanks,
Kevin
Hello! I just started using this repository to get syntax highlighting for ES6 features, and I found a couple of issues:
syntax/vim-es6/modules/*.vim
, but the modules are placed in syntax/modules/
directory.if exists("did_javascript_hilink")
, but this variable isn't set anywhere.HiLight
function, which is defined in the main syntax file later, thus it's inaccessible by the modules.I fixed these errors to make things work for me, I'll make a pull request in a minute :)
Would be great if it supported template strings! I have work to do so can't investigate this at the moment, but since it's nearly identical to ruby string interpolation, this may be a good starting point:
https://github.com/vim/vim/blob/db9bc0b7931d252cf578c1cd298ac905b904ebe7/runtime/syntax/ruby.vim#L43
Example:
if ((1) ||
(2) ||
(3)
) {
echo 'foo';
}
The above is bad because visually it looks like we're still inside the if statement as the indent has changed.
It's also a little messed up in the case of the ) {
inline on the third line:
if ((1) ||
(2) ||
(3)) {
echo 'foo';
}
but it gets worse with two lines inside the if:
if (1 ||
2 ||
3) {
echo 'foo';
echo 'bar';
}
and finally, with the bracket on a new line:
if ((1) ||
(2) ||
(3))
{
echo 'foo';
}
I would expect these to indent as so:
if ((1) ||
(2) ||
(3)
) {
echo 'foo';
}
if ((1) ||
(2) ||
(3)) {
echo 'foo';
}
if (1 ||
2 ||
3) {
echo 'foo';
echo 'bar';
}
if ((1) ||
(2) ||
(3))
{
echo 'foo';
}
or like this (possibly configurable):
if ((1) ||
(2) ||
(3)
) {
echo 'foo';
}
if ((1) ||
(2) ||
(3)) {
echo 'foo';
}
if (1 ||
2 ||
3) {
echo 'foo';
echo 'bar';
}
if ((1) ||
(2) ||
(3))
{
echo 'foo';
}
First off, thanks for the great plugin! I'm new to vim so i'm not much help looking into issues yet, but I just pulled the latest commit and it appears to break string highlighting on all my import statements.
For example, with import logger from '../util/logger';
the path string used to be highlighted green for me, but now it looks just like plain text. I've reverted back to the previous commit and it works fine again.
Any ideas? Thanks!
Hi,
with the following code :
function f() {
const r = /foo.*/;
console.log(r);
}
If you run gg=G
to reindent the full file, you will get :
function f() {
const r = /foo.*/;
console.log(r);
}
which is obviously not expected
This package handles multi-line method indent like this:
const foo = this.someMethod()
.someOtherMethod();
But it should handle it like this (or at least provide the option to handle it this way):
const foo = this.someMethod()
.someOtherMethod();
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.