Mercurial > vim
annotate runtime/autoload/cargo.vim @ 33791:370543108ba1 v9.0.2114
patch 9.0.2114: overflow detection not accurate when adding digits
Commit: https://github.com/vim/vim/commit/22cbc8a4e17ce61aa460c451a26e1bff2c3d2af9
Author: Christian Brabandt <cb@256bit.org>
Date: Sun Nov 19 10:47:21 2023 +0100
patch 9.0.2114: overflow detection not accurate when adding digits
Problem: overflow detection not accurate when adding digits
Solution: Use a helper function
Use a helper function to better detect overflows before adding integer
digits to a long or an integer variable respectively. Signal the
overflow to the caller function.
closes: #13539
Signed-off-by: Christian Brabandt <cb@256bit.org>
Signed-off-by: Michael Henry <vim@drmikehenry.com>
Signed-off-by: Ernie Rael <errael@raelity.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 19 Nov 2023 11:00:07 +0100 |
parents | 555fede66c30 |
children |
rev | line source |
---|---|
33255
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Last Modified: 2023-09-11 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 function! cargo#Load() |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 " Utility call to get this script loaded, for debugging |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 endfunction |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 function! cargo#cmd(args) abort |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 " Trim trailing spaces. This is necessary since :terminal command parses |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 " trailing spaces as an empty argument. |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 let args = substitute(a:args, '\s\+$', '', '') |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 if exists('g:cargo_shell_command_runner') |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 let cmd = g:cargo_shell_command_runner |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 elseif has('terminal') |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 let cmd = 'terminal' |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 elseif has('nvim') |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 let cmd = 'noautocmd new | terminal' |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 else |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 let cmd = '!' |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 endif |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 execute cmd 'cargo' args |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 endfunction |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 function! s:nearest_cargo(...) abort |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 " If the second argument is not specified, the first argument determines |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 " whether we will start from the current directory or the directory of the |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 " current buffer, otherwise, we start with the provided path on the |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 " second argument. |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 let l:is_getcwd = get(a:, 1, 0) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 if l:is_getcwd |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 let l:starting_path = get(a:, 2, getcwd()) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 else |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 let l:starting_path = get(a:, 2, expand('%:p:h')) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 endif |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 return findfile('Cargo.toml', l:starting_path . ';') |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 endfunction |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 function! cargo#nearestCargo(is_getcwd) abort |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 return s:nearest_cargo(a:is_getcwd) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 endfunction |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 function! cargo#nearestWorkspaceCargo(is_getcwd) abort |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 let l:nearest = s:nearest_cargo(a:is_getcwd) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 while l:nearest !=# '' |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 for l:line in readfile(l:nearest, '', 0x100) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 if l:line =~# '\V[workspace]' |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 return l:nearest |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 endif |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 endfor |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 let l:next = fnamemodify(l:nearest, ':p:h:h') |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 let l:nearest = s:nearest_cargo(0, l:next) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 endwhile |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 return '' |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 endfunction |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 function! cargo#nearestRootCargo(is_getcwd) abort |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 " Try to find a workspace Cargo.toml, and if not found, take the nearest |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 " regular Cargo.toml |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 let l:workspace_cargo = cargo#nearestWorkspaceCargo(a:is_getcwd) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 if l:workspace_cargo !=# '' |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 return l:workspace_cargo |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 endif |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 return s:nearest_cargo(a:is_getcwd) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 endfunction |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
66 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 function! cargo#build(args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 call cargo#cmd("build " . a:args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 endfunction |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
71 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
72 function! cargo#check(args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
73 call cargo#cmd("check " . a:args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 endfunction |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
75 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
76 function! cargo#clean(args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
77 call cargo#cmd("clean " . a:args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
78 endfunction |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
79 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
80 function! cargo#doc(args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
81 call cargo#cmd("doc " . a:args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
82 endfunction |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
83 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
84 function! cargo#new(args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
85 call cargo#cmd("new " . a:args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
86 cd `=a:args` |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 endfunction |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
89 function! cargo#init(args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
90 call cargo#cmd("init " . a:args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
91 endfunction |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
92 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
93 function! cargo#run(args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
94 call cargo#cmd("run " . a:args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
95 endfunction |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
96 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
97 function! cargo#test(args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
98 call cargo#cmd("test " . a:args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
99 endfunction |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
100 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
101 function! cargo#bench(args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
102 call cargo#cmd("bench " . a:args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
103 endfunction |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
104 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
105 function! cargo#update(args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
106 call cargo#cmd("update " . a:args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
107 endfunction |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
108 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
109 function! cargo#search(args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
110 call cargo#cmd("search " . a:args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
111 endfunction |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
112 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
113 function! cargo#publish(args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
114 call cargo#cmd("publish " . a:args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
115 endfunction |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
116 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
117 function! cargo#install(args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
118 call cargo#cmd("install " . a:args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
119 endfunction |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
120 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
121 function! cargo#runtarget(args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
122 let l:filename = expand('%:p') |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
123 let l:read_manifest = system('cargo read-manifest') |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
124 let l:metadata = json_decode(l:read_manifest) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
125 let l:targets = get(l:metadata, 'targets', []) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
126 let l:did_run = 0 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
127 for l:target in l:targets |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
128 let l:src_path = get(l:target, 'src_path', '') |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
129 let l:kinds = get(l:target, 'kind', []) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
130 let l:name = get(l:target, 'name', '') |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
131 if l:src_path == l:filename |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
132 if index(l:kinds, 'example') != -1 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
133 let l:did_run = 1 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
134 call cargo#run("--example " . shellescape(l:name) . " " . a:args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
135 return |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
136 elseif index(l:kinds, 'bin') != -1 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
137 let l:did_run = 1 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
138 call cargo#run("--bin " . shellescape(l:name) . " " . a:args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
139 return |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
140 endif |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
141 endif |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
142 endfor |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
143 if l:did_run != 1 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
144 call cargo#run(a:args) |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
145 return |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
146 endif |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
147 endfunction |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
148 |
555fede66c30
runtime(rust): sync rust runtime files with upstream (#13075)
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
149 " vim: set et sw=4 sts=4 ts=8: |