Merge pull request #13523 from janlazo/javascript-runtime

Update Javascript runtime
This commit is contained in:
Jan Edmund Lazo 2020-12-12 13:31:47 -05:00 committed by GitHub
commit 257c0f89a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 95 additions and 30 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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