From e2be382977c37548f92d2a76e6a48ba65ff5e95f Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 12 Dec 2020 11:31:28 -0500 Subject: runtime/javascript: 5be4ceecea5520265066eac972460ebb1cdf05e7 Port javascript syntax files only. Ref: https://github.com/neovim/neovim/issues/13185 --- runtime/syntax/javascript.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/syntax/javascript.vim b/runtime/syntax/javascript.vim index 78714d0170..5c6439f9e0 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: 2019 Sep 27 " 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 -- cgit From 552ff68349b78d6053daa11f931df011634e702d Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 12 Dec 2020 11:33:53 -0500 Subject: runtime/javascript: 09c6f265b21065ffa9437837b1d0955137175e45 Port javascriptreact.vim syntax only. Ref https://github.com/neovim/neovim/issues/13185 --- runtime/syntax/javascriptreact.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 -- cgit From a2f8a795cd7f7441f8626c0b0335042393078aee Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 12 Dec 2020 11:36:10 -0500 Subject: runtime/javascript: 388a5d4f20b4b64341d1604aa238cab85827b892 Port javascript syntax file only. Ref https://github.com/neovim/neovim/issues/13185 --- runtime/syntax/javascript.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/syntax/javascript.vim b/runtime/syntax/javascript.vim index 5c6439f9e0..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: 2019 Sep 27 +" Last Change: 2020 May 14 " 2013 Jun 12: adjusted javaScriptRegexpString (Kevin Locke) " 2018 Apr 14: adjusted javaScriptRegexpString (LongJohnCoder) @@ -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 -- cgit From a8860b033f2f6f0ef5354d51c7ccfaa274f7068e Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 12 Dec 2020 11:37:50 -0500 Subject: runtime/javascript: e7b1ea0276cc83cd5c612f3189a174a60d57b5ed Port javascript autocomplete file only. --- runtime/autoload/javascriptcomplete.vim | 44 ++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 11 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 -- cgit From 4fa6aa90ad91f3828da82fe1ba1a063890928e94 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 12 Dec 2020 11:40:25 -0500 Subject: runtime/javascript: 207f009326c8f878defde0e594d7d9ed9860106e Port javascript and javascript react ftplugins only. --- runtime/ftplugin/javascript.vim | 61 +++++++++++++++++++++++++++++------- runtime/ftplugin/javascriptreact.vim | 5 +++ 2 files changed, 54 insertions(+), 12 deletions(-) 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 -" Last Change: 2008 Jun 15 -" URL: http://gus.gscit.monash.edu.au/~djkea2/vim/ftplugin/javascript.vim +" Language: Javascript +" Maintainer: Doug Kearns +" Last Change: 2020 Jun 23 +" Contributor: Romain Lafourcade 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 or using "o". +" and insert the comment leader when hitting 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 = + \ '\:\,' + \ .. '<\@<=\([^ \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\)' + \ .. '\|\' + +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 +" Last Change: 2020 Aug 19 + " Placeholder for backwards compatilibity: .jsx used to stand for JavaScript. runtime! ftplugin/javascript.vim -- cgit