diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-12-12 13:31:47 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-12 13:31:47 -0500 |
commit | 257c0f89a926b76a6a8d95ea8bd45a707a47bbb4 (patch) | |
tree | 55d28a9d15828b1e84aaae02e304ca6623c7086c | |
parent | 4f9e7a512dc606ddaff6dbfd78328077d685960d (diff) | |
parent | 4fa6aa90ad91f3828da82fe1ba1a063890928e94 (diff) | |
download | rneovim-257c0f89a926b76a6a8d95ea8bd45a707a47bbb4.tar.gz rneovim-257c0f89a926b76a6a8d95ea8bd45a707a47bbb4.tar.bz2 rneovim-257c0f89a926b76a6a8d95ea8bd45a707a47bbb4.zip |
Merge pull request #13523 from janlazo/javascript-runtime
Update Javascript runtime
-rw-r--r-- | runtime/autoload/javascriptcomplete.vim | 44 | ||||
-rw-r--r-- | runtime/ftplugin/javascript.vim | 61 | ||||
-rw-r--r-- | runtime/ftplugin/javascriptreact.vim | 5 | ||||
-rw-r--r-- | runtime/syntax/javascript.vim | 12 | ||||
-rw-r--r-- | runtime/syntax/javascriptreact.vim | 3 |
5 files changed, 95 insertions, 30 deletions
diff --git a/runtime/autoload/javascriptcomplete.vim b/runtime/autoload/javascriptcomplete.vim index 14bc3d7ce3..29b6b16254 100644 --- a/runtime/autoload/javascriptcomplete.vim +++ b/runtime/autoload/javascriptcomplete.vim @@ -1,7 +1,9 @@ " Vim completion script " Language: Java Script -" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) -" Last Change: 2017 Mar 04 +" Maintainer: Jay Sitter (jay@jaysitter.com) +" URL: https://github.com/jsit/javascriptcomplete.vim/ +" Previous Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) +" Last Change: 2020 Jul 30 function! javascriptcomplete#CompleteJS(findstart, base) if a:findstart @@ -154,12 +156,30 @@ function! javascriptcomplete#CompleteJS(findstart, base) \ 'text', 'vLink'] let bodys = bodyprop " Document - document. - let docuprop = ['anchors', 'applets', 'childNodes', 'embeds', 'forms', 'images', 'links', 'stylesheets', - \ 'body', 'cookie', 'documentElement', 'domain', 'lastModified', 'referrer', 'title', 'URL'] - let documeth = ['close', 'createAttribute', 'createElement', 'createTextNode', 'focus', 'getElementById', - \ 'getElementsByName', 'getElementsByTagName', 'open', 'write', 'writeln', - \ 'onClick', 'onDblClick', 'onFocus', 'onKeyDown', 'onKeyPress', 'onKeyUp', - \ 'onMouseDown', 'onMouseMove', 'onMouseOut', 'onMouseOver', 'onMouseUp', 'onResize'] + let docuprop = ['anchors', 'body', 'characterSet', 'doctype', + \ 'documentElement', 'documentURI', 'embeds', 'fonts', 'forms', + \ 'head', 'hidden', 'images', 'implementation', 'lastStyleSheetSet', + \ 'links', 'plugins', 'preferredStyleSheetSet', 'scripts', + \ 'scrollingElement', 'selectedStyleSheetSet', 'styleSheetSets', + \ 'timeline', 'visibilityState', 'cookie', 'defaultView', + \ 'designMode', 'dir', 'domain', 'lastModified', 'location', + \ 'readyState', 'referrer', 'title', 'URL', 'activeElement', + \ 'fullscreenElement', 'styleSheets'] + let documeth = ['adoptNode', 'close', 'createAttribute', + \ 'createAttributeNS', 'createCDATASection', 'createComment', + \ 'createDocumentFragment', 'createElement', 'createElementNS', + \ 'createEvent', 'createExpression', 'createNSResolver', + \ 'createNodeIterator', 'createProcessingInstruction', 'createRange', + \ 'createTextNode', 'createTouchList', 'createTreeWalker', + \ 'enableStyleSheetsForSet', 'evaluate', 'focus', 'getElementById', + \ 'getElementById', 'getElementsByClassName', 'getElementsByName', + \ 'getElementsByTagName', 'getElementsByTagNameNS', + \ 'hasStorageAccess', 'importNode', 'onClick', 'onDblClick', + \ 'onFocus', 'onKeyDown', 'onKeyPress', 'onKeyUp', 'onMouseDown', + \ 'onMouseMove', 'onMouseOut', 'onMouseOver', 'onMouseUp', + \ 'onResize', 'open', 'querySelector', 'querySelectorAll', + \ 'requestStorageAccess', 'write', 'writeln'] + call map(documeth, 'v:val."("') let docuxprop = ['attributes', 'childNodes', 'doctype', 'documentElement', 'firstChild', \ 'implementation', 'namespaceURI', 'nextSibling', 'nodeName', 'nodeType', @@ -368,9 +388,11 @@ function! javascriptcomplete#CompleteJS(findstart, base) let xdomelemprop = ['attributes', 'childNodes', 'firstChild', 'lastChild', \ 'namespaceURI', 'nextSibling', 'nodeName', 'nodeType', 'nodeValue', \ 'ownerDocument', 'parentNode', 'prefix', 'previousSibling', 'tagName'] - let xdomelemmeth = ['appendChild', 'cloneNode', 'getAttribute', 'getAttributeNode', - \ 'getElementsByTagName', 'hasChildNodes', 'insertBefore', 'normalize', - \ 'removeAttribute', 'removeAttributeNode', 'removeChild', 'replaceChild', + let xdomelemmeth = ['appendChild', 'addEventListener', 'cloneNode', + \ 'dispatchEvent', 'getAttribute', 'getAttributeNode', + \ 'getElementsByTagName', 'hasChildNodes', 'insertBefore', + \ 'normalize', 'removeAttribute', 'removeAttributeNode', + \ 'removeChild', 'removeEventListener', 'replaceChild', \ 'setAttribute', 'setAttributeNode'] call map(xdomelemmeth, 'v:val."("') let xdomelems = xdomelemprop + xdomelemmeth diff --git a/runtime/ftplugin/javascript.vim b/runtime/ftplugin/javascript.vim index af5e4a920c..9a0b29e0ca 100644 --- a/runtime/ftplugin/javascript.vim +++ b/runtime/ftplugin/javascript.vim @@ -1,11 +1,11 @@ " Vim filetype plugin file -" Language: Javascript -" Maintainer: Doug Kearns <dougkearns@gmail.com> -" Last Change: 2008 Jun 15 -" URL: http://gus.gscit.monash.edu.au/~djkea2/vim/ftplugin/javascript.vim +" Language: Javascript +" Maintainer: Doug Kearns <dougkearns@gmail.com> +" Last Change: 2020 Jun 23 +" Contributor: Romain Lafourcade <romainlafourcade@gmail.com> if exists("b:did_ftplugin") - finish + finish endif let b:did_ftplugin = 1 @@ -13,7 +13,7 @@ let s:cpo_save = &cpo set cpo-=C " Set 'formatoptions' to break comment lines but not other lines, -" " and insert the comment leader when hitting <CR> or using "o". +" and insert the comment leader when hitting <CR> or using "o". setlocal formatoptions-=t formatoptions+=croql " Set completion with CTRL-X CTRL-O to autoloaded function. @@ -26,13 +26,50 @@ setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// setlocal commentstring=//%s -" Change the :browse e filter to primarily show Java-related files. -if has("gui_win32") - let b:browsefilter="Javascript Files (*.js)\t*.js\n" . - \ "All Files (*.*)\t*.*\n" +" Change the :browse e filter to primarily show JavaScript-related files. +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") + let b:browsefilter = + \ "JavaScript Files (*.js)\t*.js\n" + \ .. "JSX Files (*.jsx)\t*.jsx\n" + \ .. "JavaScript Modules (*.es, *.es6, *.cjs, *.mjs, *.jsm)\t*.es;*.es6;*.cjs;*.mjs;*.jsm\n" + \ .. "Vue Templates (*.vue)\t*.vue\n" + \ .. "JSON Files (*.json)\t*.json\n" + \ .. "All Files (*.*)\t*.*\n" endif - -let b:undo_ftplugin = "setl fo< ofu< com< cms<" + +" The following suffixes should be implied when resolving filenames +setlocal suffixesadd+=.js,.jsx,.es,.es6,.cjs,.mjs,.jsm,.vue,.json + +" The following suffixes should have low priority +" .snap jest snapshot +setlocal suffixes+=.snap + +" Remove irrelevant part of 'path'. +" User is expected to augment it with contextually-relevant paths +setlocal path-=/usr/include + +" Matchit configuration +if exists("loaded_matchit") + let b:match_ignorecase = 0 + let b:match_words = + \ '\<do\>:\<while\>,' + \ .. '<\@<=\([^ \t>/]\+\)\%(\s\+[^>]*\%([^/]>\|$\)\|>\|$\):<\@<=/\1>,' + \ .. '<\@<=\%([^ \t>/]\+\)\%(\s\+[^/>]*\|$\):/>' +endif + +" Set 'define' to a comprehensive value +let &l:define = + \ '\(^\s*(*async\s\+function\|(*function\)' + \ .. '\|^\s*\(\*\|static\|async\|get\|set\|\i\+\.\)' + \ .. '\|^\s*\(\ze\i\+\)\(([^)]*).*{$\|\s*[:=,]\)' + \ .. '\|^\s*\(export\s\+\|export\s\+default\s\+\)*\(var\|let\|const\|function\|class\)' + \ .. '\|\<as\>' + +let b:undo_ftplugin = + \ "setl fo< ofu< com< cms< sua< su< def< pa<" + \ .. "| unlet! b:browsefilter b:match_ignorecase b:match_words" let &cpo = s:cpo_save unlet s:cpo_save + +" vim: textwidth=78 tabstop=8 shiftwidth=4 softtabstop=4 expandtab diff --git a/runtime/ftplugin/javascriptreact.vim b/runtime/ftplugin/javascriptreact.vim index af318a01d6..b9c39d5e68 100644 --- a/runtime/ftplugin/javascriptreact.vim +++ b/runtime/ftplugin/javascriptreact.vim @@ -1,2 +1,7 @@ +" Vim filetype plugin file +" Language: JavaScript React +" Maintainer: Doug Kearns <dougkearns@gmail.com> +" Last Change: 2020 Aug 19 + " Placeholder for backwards compatilibity: .jsx used to stand for JavaScript. runtime! ftplugin/javascript.vim diff --git a/runtime/syntax/javascript.vim b/runtime/syntax/javascript.vim index 78714d0170..8a5e10b261 100644 --- a/runtime/syntax/javascript.vim +++ b/runtime/syntax/javascript.vim @@ -7,7 +7,7 @@ " (ss) repaired several quoting and grouping glitches " (ss) fixed regex parsing issue with multiple qualifiers [gi] " (ss) additional factoring of keywords, globals, and members -" Last Change: 2018 Jul 28 +" Last Change: 2020 May 14 " 2013 Jun 12: adjusted javaScriptRegexpString (Kevin Locke) " 2018 Apr 14: adjusted javaScriptRegexpString (LongJohnCoder) @@ -48,7 +48,7 @@ syn keyword javaScriptRepeat while for do in syn keyword javaScriptBranch break continue syn keyword javaScriptOperator new delete instanceof typeof syn keyword javaScriptType Array Boolean Date Function Number Object String RegExp -syn keyword javaScriptStatement return with +syn keyword javaScriptStatement return with await syn keyword javaScriptBoolean true false syn keyword javaScriptNull null undefined syn keyword javaScriptIdentifier arguments this var let @@ -58,7 +58,7 @@ syn keyword javaScriptMessage alert confirm prompt status syn keyword javaScriptGlobal self window top parent syn keyword javaScriptMember document event location syn keyword javaScriptDeprecated escape unescape -syn keyword javaScriptReserved abstract boolean byte char class const debugger double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile +syn keyword javaScriptReserved abstract boolean byte char class const debugger double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile async syn cluster javaScriptEmbededExpr contains=javaScriptBoolean,javaScriptNull,javaScriptIdentifier,javaScriptStringD,javaScriptStringS,javaScriptStringT @@ -77,10 +77,10 @@ else syn match javaScriptParens "[()]" endif -syn sync fromstart -syn sync maxlines=100 - if main_syntax == "javascript" + syn sync fromstart + syn sync maxlines=100 + syn sync ccomment javaScriptComment endif diff --git a/runtime/syntax/javascriptreact.vim b/runtime/syntax/javascriptreact.vim index fc49691cb0..0067a0b352 100644 --- a/runtime/syntax/javascriptreact.vim +++ b/runtime/syntax/javascriptreact.vim @@ -1,2 +1,3 @@ -" Placeholder for backwards compatilibity: .jsx used to stand for JavaScript. +" Placeholder for backwards compatilibity: .jsx used to be associated with the +" filetpye JavaScript. runtime! syntax/javascript.vim |