annotate runtime/ftplugin/javascript.vim @ 24610:c1263588156b v8.2.2844

patch 8.2.2844: Vim9: memory leak when using searchpair() Commit: https://github.com/vim/vim/commit/24f720998f852dd1ba861ec67d56625a507b915e Author: Bram Moolenaar <Bram@vim.org> Date: Fri May 7 20:43:54 2021 +0200 patch 8.2.2844: Vim9: memory leak when using searchpair() Problem: Vim9: memory leak when using searchpair(). Solution: Free the v_instr field.
author Bram Moolenaar <Bram@vim.org>
date Fri, 07 May 2021 20:45:03 +0200
parents bbca88cd13d5
children 8ae680be2a51
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
1 " Vim filetype plugin file
21991
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
2 " Language: Javascript
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
3 " Maintainer: Doug Kearns <dougkearns@gmail.com>
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
4 " Last Change: 2020 Jun 23
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
5 " Contributor: Romain Lafourcade <romainlafourcade@gmail.com>
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
6
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
7 if exists("b:did_ftplugin")
21991
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
8 finish
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
9 endif
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
10 let b:did_ftplugin = 1
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
11
1125
96cd8222a819 updated for version 7.1a
vimboss
parents: 651
diff changeset
12 let s:cpo_save = &cpo
96cd8222a819 updated for version 7.1a
vimboss
parents: 651
diff changeset
13 set cpo-=C
96cd8222a819 updated for version 7.1a
vimboss
parents: 651
diff changeset
14
96cd8222a819 updated for version 7.1a
vimboss
parents: 651
diff changeset
15 " Set 'formatoptions' to break comment lines but not other lines,
21991
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
16 " and insert the comment leader when hitting <CR> or using "o".
1125
96cd8222a819 updated for version 7.1a
vimboss
parents: 651
diff changeset
17 setlocal formatoptions-=t formatoptions+=croql
96cd8222a819 updated for version 7.1a
vimboss
parents: 651
diff changeset
18
96cd8222a819 updated for version 7.1a
vimboss
parents: 651
diff changeset
19 " Set completion with CTRL-X CTRL-O to autoloaded function.
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
20 if exists('&ofu')
1125
96cd8222a819 updated for version 7.1a
vimboss
parents: 651
diff changeset
21 setlocal omnifunc=javascriptcomplete#CompleteJS
651
bc95c6c4bac1 updated for version 7.0191
vimboss
parents:
diff changeset
22 endif
1125
96cd8222a819 updated for version 7.1a
vimboss
parents: 651
diff changeset
23
96cd8222a819 updated for version 7.1a
vimboss
parents: 651
diff changeset
24 " Set 'comments' to format dashed lists in comments.
96cd8222a819 updated for version 7.1a
vimboss
parents: 651
diff changeset
25 setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
96cd8222a819 updated for version 7.1a
vimboss
parents: 651
diff changeset
26
96cd8222a819 updated for version 7.1a
vimboss
parents: 651
diff changeset
27 setlocal commentstring=//%s
96cd8222a819 updated for version 7.1a
vimboss
parents: 651
diff changeset
28
21991
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
29 " Change the :browse e filter to primarily show JavaScript-related files.
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
30 if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
31 let b:browsefilter =
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
32 \ "JavaScript Files (*.js)\t*.js\n"
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
33 \ .. "JSX Files (*.jsx)\t*.jsx\n"
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
34 \ .. "JavaScript Modules (*.es, *.es6, *.cjs, *.mjs, *.jsm)\t*.es;*.es6;*.cjs;*.mjs;*.jsm\n"
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
35 \ .. "Vue Templates (*.vue)\t*.vue\n"
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
36 \ .. "JSON Files (*.json)\t*.json\n"
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
37 \ .. "All Files (*.*)\t*.*\n"
1125
96cd8222a819 updated for version 7.1a
vimboss
parents: 651
diff changeset
38 endif
21991
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
39
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
40 " The following suffixes should be implied when resolving filenames
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
41 setlocal suffixesadd+=.js,.jsx,.es,.es6,.cjs,.mjs,.jsm,.vue,.json
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
42
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
43 " The following suffixes should have low priority
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
44 " .snap jest snapshot
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
45 setlocal suffixes+=.snap
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
46
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
47 " Remove irrelevant part of 'path'.
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
48 " User is expected to augment it with contextually-relevant paths
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
49 setlocal path-=/usr/include
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
50
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
51 " Matchit configuration
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
52 if exists("loaded_matchit")
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
53 let b:match_ignorecase = 0
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
54 let b:match_words =
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
55 \ '\<do\>:\<while\>,'
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
56 \ .. '<\@<=\([^ \t>/]\+\)\%(\s\+[^>]*\%([^/]>\|$\)\|>\|$\):<\@<=/\1>,'
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
57 \ .. '<\@<=\%([^ \t>/]\+\)\%(\s\+[^/>]*\|$\):/>'
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
58 endif
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
59
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
60 " Set 'define' to a comprehensive value
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
61 let &l:define =
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
62 \ '\(^\s*(*async\s\+function\|(*function\)'
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
63 \ .. '\|^\s*\(\*\|static\|async\|get\|set\|\i\+\.\)'
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
64 \ .. '\|^\s*\(\ze\i\+\)\(([^)]*).*{$\|\s*[:=,]\)'
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
65 \ .. '\|^\s*\(export\s\+\|export\s\+default\s\+\)*\(var\|let\|const\|function\|class\)'
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
66 \ .. '\|\<as\>'
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
67
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
68 let b:undo_ftplugin =
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
69 \ "setl fo< ofu< com< cms< sua< su< def< pa<"
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
70 \ .. "| unlet! b:browsefilter b:match_ignorecase b:match_words"
1125
96cd8222a819 updated for version 7.1a
vimboss
parents: 651
diff changeset
71
96cd8222a819 updated for version 7.1a
vimboss
parents: 651
diff changeset
72 let &cpo = s:cpo_save
96cd8222a819 updated for version 7.1a
vimboss
parents: 651
diff changeset
73 unlet s:cpo_save
21991
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
74
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 1623
diff changeset
75 " vim: textwidth=78 tabstop=8 shiftwidth=4 softtabstop=4 expandtab