GithubHelp home page GithubHelp logo

othree / javascript-libraries-syntax.vim Goto Github PK

View Code? Open in Web Editor NEW
623.0 9.0 36.0 305 KB

Syntax for JavaScript libraries

Home Page: http://www.vim.org/scripts/script.php?script_id=4428

Makefile 3.83% Shell 0.11% Vim Script 96.06%

javascript-libraries-syntax.vim's People

Contributors

bronzehedwick avatar gmitrev avatar huttli avatar lencioni avatar mortonfox avatar othree avatar pgilad avatar rafabene avatar sfinktah avatar tlvince avatar watagashi avatar weirongxu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

javascript-libraries-syntax.vim's Issues

doesn't work with native omnifunc javascript

I've installed YCM and the following plugins

 Plugin 'jelera/vim-javascript-syntax'
 Plugin 'othree/javascript-libraries-syntax.vim'
 Plugin 'othree/vim-coffee-script'
 Plugin 'mattn/jscomplete-vim'

But the native JavaScript is not autocompleted,

But if I put autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
at the end of vimrc, then it'll enable native javscript autocomplete. And other syntax autocomplete will be disabled.

I wonder what's going on, it would be better if could help out.

No TypeScript support

I don't have TypeScript support.

First i figured out that the filetype was not set to typescript. Vim told me after
:set ft?
that the filetype is xml
filetype=xml
so i have set it manually with
autocmd BuffNewFile,BuffRead *.ts set filetype=typescript
but it didn't solve the problem. A workaround would be to set the filetype to javascript, but i would rather use your specific syntax file. :)

syntax support for Jasmine

please add syntax support for Jasmine:
https://github.com/pivotal/jasmine
http://jasmine.github.io/

Jasmine has special functions:
describe
it
expect
not
toBe
toHaveBeenCalled
andCallThrough
andReturn

beforeEach
afterEach

xdescribe
xit

(matchers)
expect(x).toEqual(y); compares objects or primitives x and y and passes if they are equivalent

expect(x).toBe(y); compares objects or primitives x and y and passes if they are the same object

expect(x).toMatch(pattern); compares x to string or regular expression pattern and passes if they match

expect(x).toBeDefined(); passes if x is not undefined

expect(x).toBeUndefined(); passes if x is undefined

expect(x).toBeNull(); passes if x is null

expect(x).toBeTruthy(); passes if x evaluates to true

expect(x).toBeFalsy(); passes if x evaluates to false

expect(x).toContain(y); passes if array or string x contains y

expect(x).toBeLessThan(y); passes if x is less than y

expect(x).toBeGreaterThan(y); passes if x is greater than y

expect(function(){fn();}).toThrow(e); passes if function fn throws exception e when executed

Javascript Files and Mouse Scrolling

I recently had an issue with this plugin. Whenever I opened a javascript file in any of my vim sessions scrolling up and down was really slow. I didn't have time initially to narrow down which plugin caused it so I wrote a quick function to toggle syntax on and syntax off which fixed it for that session. After disabling the js libaries syntax vim plugin all is back to normal. I'm using Vim 7.3.854 compiled on OS X with Janus. Thanks!

jslibsyntax#load() not being called

After #9, javascript-libraries-syntax.vim loads (my vim setup is in a path that contains whitespace; /Users/tom/Library/Application Support/vim).

However, the after/* files do not appear to be sourced as I have to manually call jslibsyntax#load(). Any ideas why this may be? I'm running javascript-libraries-syntax.vim via pathogen.

Properties that are keywords cause cascading highlighting issues

I also use vim-javascript for my normal syntax highlighting. However, I've tried commenting out this library in my setup and I don't see the bug, so something here clashes with the setup there. Without this library, vim-javascript correctly does not highlight javascript keywords used as object properties, like obj.class = 'success'. With this library, class gets highlighted according to the syntax highlighting specified by vim-javascript (which is to say, it's the same color "class" would be when used as a class declaration). That by itself isn't really a problem; I could live with it. The problem is that subsequent text is then highlighted erratically because this library seems to think it was an actual class declaration and is expecting the class itself to follow. Here's a screen shot. Note how "MemberService.member.personal.firstname" is yellow. Without this library, it's white, as I'd expect for any object property path.

screen shot 41

Suggestion: use syntax iskeyword against set iskeyword

In the file /autoload/syntax/angular.html.vim there is:

setlocal iskeyword+=-

But this will change how motion w works on the symbol -.

I think syntax iskeyword @,48-57,_,192-255,$,- is better.

As vim document said,

This defines the keyword characters.  It's like the `iskeyword` for but only applies to syntax highlighting.

Support for Express.js ?

Excellent work on this package, I absolutely love it. It would be totally awesome if you could add support for express.js !

momentjs

Can you please tell me how to include mommentJS so I can contribute with you with my favo libraries http://jsbd.io ;)

Change implementation for css selector in jQuery throws me an error

The commit Change implementation for css selector in jQuery (97ea998) throws me an error when I start editing a new javascript file.

E400: No cluster specified
E475: Invalid argument: cssSelectors              containedin=javascriptString contains=cssId,cssClass,cssOperators,cssBasicFilters,cssContentFilters,cssVisibility,cssChildFilters,cssForms,cssFormFilters

how to profile plugin

Hi othree,

Thanks for this awesome plugin :) It works great for me except after I turned on angularjs highlight, my vim becomes very laggy. Is there anyway to profile the plugin so I can find out which part slows down my vim?

No syntas highlights for jQuery functions.

Hi,
I install this plugin with Vundle,everything seems OK.

Then I open a simple .js file,(I know jQuery is enabled by default.)just input:

jQuery("#id").ready(function(){

        });

Anyhow,the word ready is displayed as plain text ,rather than function color.

So , did I use it in the wrong way ?

Ps:
Is this plugin conflict with othree/javascript-libraries-syntax.vim'?

Thanks.

Looks like plugin not works for me

Here is a part of my Vim config file:

" Scripts

Plug 'pangloss/vim-javascript', { 'for': 'javascript' }
Plug 'othree/javascript-libraries-syntax.vim', { 'for': 'javascript' }
Plug 'fleischie/vim-styled-components', { 'for': 'javascript' }

let g:javascript_plugin_jsdoc = 1
let g:used_javascript_libs = 'react,vue,underscore,jasmine'

Your plugin works good for me some time ago. But now it looks like not.

All plugins was updated today. What's wrong here?

screenshot from 2017-03-28 16-08-09

d3 highlighting does not seem to recognize d3 methods.

When using highlighting for d3, 'd3' is highlighted correctly. But after 'd3' no methods are recognized.
When inspecting which highlight group is attached to d3.selectAll() no highlightgroup is shown.

let g:used_javascript_libs='d3'

When adding jquery highlighting, d3.select() is highlighted as 'javascriptQEvents'.

Unfortunately I seem unable to find a fix myself.

Omnicomplete Not Working in HTML Files

After installing othree/javascript-libraries-syntax.vim
via pathogen, I am not able to get omnicomplete to recognize ng directives (ng-controller, etc.) in html files. Syntax highlighting works when I type out the entire name of a directive, but typing ng- and then Ctrl-X Ctrl-O results in no pattern being matched by omnicomplete. I am using Vim version 8.0.494 running in Cygwin through ConEmu. The SyntaxComplete plugin is included in this version of Vim. I have no other syntax highlighting plugins installed. I used the command :syntax to verify that the syntax highlighting rules in the plugin's angularjs.html.vim file were in place. I used the command :set omnifunc? to verify that omnifunc=htmlcomplete#CompleteTags.

Adding support for chaijs

I wanted to enable syntax highlighting for chaijs with javascript and committed this file lately 5083ca8. I thought it might benefit other users of this very nice plugin.

I'm not a regular user of coffeescript/ls/typescript. I was hoping there would be an "automated way" to generate the corresponding syntax file, and maybe make a pull request afterwards.

Ramda support

Support for ramda would be great. I don't know anything about vim syntax coloring, otherwise I'd help (might look into it though). However, it should be very similar to lodash—if not exactly the same.

Error when loading sugar.coffee.vim

I get the following error when loading sugar.coffee.vim. It seems to be due to using "contains" as an argument to coffeeSFunction.

Error detected while processing
.../javascript-libraries-syntax.vim/autoload/syntax/sugar.coffee.vim:
line 72: E395: contains argument not accepted here
E475: Invalid argument: coffeeSFunction contained clamp clone contains every intersect isValid span toString union
E395: contains argument not accepted here
E475: Invalid argument: coffeeSFunction contained clamp clone contains every intersect isValid span toString union

Coffeescript heredocs highlighting is broken

I thought this was an issue with vim-coffee-script at first, but then I found kchmck/vim-coffee-script#143 in which someone else determined the issue actually stemmed from this library. I really like having using this library in coffeescript because I write a lot of tests in coffeescript, so I get highlighting on things like describe and jasmine.createSpy so I'd rather not just turn this off for coffeescript files. Any ideas if this could be fixed?

Screen shots below of a highlighting example with this library and without it.

With (tries to treat double quotes inside heredocs as strings and pound symbols as comments . . . also breaks highlighting after the heredoc because of double quote mismatch)
screen shot 23

Without (everything looks correct, but I miss the nice highlighting on describe)
screen shot 24

Omnicompletion?

Should this also be using vims/neovims omnicomplete functionality to provide any completion? In particular, loading the plugin does give me syntax highlighting for angular, but not code completion.

Neovim support?

Seems like neovim should be supported either way, but there's no syntax highlighting when an angular file is opened in neovim. The same file with the same setup in regular vim does work however.

Urls badly highlighted in strings

Hi, thanks for your useful plugin.

Look at the following.

js-vim

As you can see in the url's value, each time we have a dot, it is considered as a cssClass so the string's highlighting is not good.

Is there any way to prevent that? Or the only solution will be to have same colors for both cssClass and javascriptString groups?

It might maybe be related to #43.

Formatting in strings

I have a jquery selector $('.ad-native-code'); where the word "native" gets syn highlighted

settings are
let g:used_javascript_libs = 'jquery,underscore,backbone,chai,handlebars'

the offending lib is "jquery"

other plugins included are:

  " react/JSX syn highlighting for .cjsx
  Plug 'mtscout6/vim-cjsx'

  " indenting/highlighting, replaces 'jelera/vim-javascript-syntax', {
  Plug 'othree/yajs.vim'
        \| Plug 'gavocanov/vim-js-indent'

  Plug 'othree/jsdoc-syntax.vim'

  Plug 'othree/jspc.vim'

  " extends syntax for with jQuery,backbone,etc.
  Plug 'othree/javascript-libraries-syntax.vim'

  " mxw/vim-jsx - react/JSX syn highlighting for .jsx
  " requires a javascript syntax plugin first (e.g. yajs or vim-javascript)
  Plug 'mxw/vim-jsx'

sugar syntax support is causing errors

Error detected while processing ~/dotfiles/vim/bundle/javascript-libraries-syntax.vim/autoload/syntax/sugar.javascript.vim:
line 72:
E395: contains argument not accepted here
E475: Invalid argument: javascriptSFunction contained clamp clone contains every intersect isValid span toString union
E395: contains argument not accepted here
E475: Invalid argument: javascriptSFunction contained clamp clone contains every intersect isValid span toString union

Add angular highlighting for $element and $attributes

The list of built-in services in #1 is fairly complete, but in directives, there are also $element and $attributes that can be injected. $element is just a jQuery object, so it wouldn't have any methods attached to it that would need to be highlighted (if jQuery highlighting is already turned on). $attributes has a few methods, however. From the docs here: $normalize, $addClass, $removeClass, $updateClass, $observe, $set, and $attr. (That last is actually just a property and not a function.) Any chance similar highlighting could be added to these things as is on the built-in services (e.g. $scope.$eval)?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.