|
3 | 3 | helpname: 'quickfix' |
4 | 4 | --- |
5 | 5 | <div id='vimCodeElement'> |
6 | | -<a class="Constant" href="quickfix.html" name="quickfix.txt">quickfix.txt</a> For <span class="Identifier">Vim バージョン 9.1.</span> Last change: 2024 Dec 16<br> |
| 6 | +<a class="Constant" href="quickfix.html" name="quickfix.txt">quickfix.txt</a> For <span class="Identifier">Vim バージョン 9.1.</span> Last change: 2024 Dec 27<br> |
7 | 7 | <br> |
8 | 8 | <br> |
9 | 9 | <span class="Identifier">VIMリファレンスマニュアル by Bram Moolenaar</span><br> |
|
1379 | 1379 | \ function('GenericPostCompilerCommand'),<br> |
1380 | 1380 | \ }<br> |
1381 | 1381 | <br> |
| 1382 | +"PostCompilerAction" が利用可能な場合、"PostCompilerActionExecutor" もサポート<br> |
| 1383 | +される。その値は、常に文字列型の単一のパラメータを宣言し、<a class="Identifier" href="quickfix.html#:cc">:cc</a> (または <a class="Identifier" href="quickfix.html#:ll">:ll</a>)<br> |
| 1384 | +の現在のステータスを確認した後、保留中のポストコンパイラアクションを含む<br> |
| 1385 | +<a class="Identifier" href="eval.html#:execute">:execute</a> をその引数にディスパッチできるかどうかを決定する関数を指す Funcref<br> |
| 1386 | +である必要がある: >vim<br> |
| 1387 | +<br> |
| 1388 | + function! GenericPostCompilerActionExecutor(action) abort<br> |
| 1389 | + try<br> |
| 1390 | + cc<br> |
| 1391 | + catch /\<E42:/<br> |
| 1392 | + execute a:action<br> |
| 1393 | + endtry<br> |
| 1394 | + endfunction<br> |
| 1395 | +<br> |
| 1396 | +補足として、利用可能な "Pre*Action" (または "*Pre*Command") の一部またはすべて<br> |
| 1397 | +は <a class="Identifier" href="quickfix.html#:make">:make</a> (または同等のもの) の前に実装内で `:doautocmd java_spotbugs_post<br> |
| 1398 | +User` を実行して、一度だけ実行される <a class="Identifier" href="autocmd.html#ShellCmdPost">ShellCmdPost</a> <a class="Comment" href="autocmd.html#:autocmd">:autocmd</a> を定義し、<br> |
| 1399 | +"PostCompilerActionExecutor" が呼び出されるように手配する。その後、このイベン<br> |
| 1400 | +トを使用するために <span class="Comment">:doautocmd java_spotbugs_post ShellCmdPost</span> を実行する:<br> |
| 1401 | +>vim<br> |
| 1402 | + function! GenericPreCompilerCommand(arguments) abort<br> |
| 1403 | + if !exists('g:spotbugs_compilation_done')<br> |
| 1404 | + doautocmd java_spotbugs_post User<br> |
| 1405 | + execute 'make ' . a:arguments<br> |
| 1406 | + " :make が同期している場合にのみ doautocmd を実行する。<br> |
| 1407 | + " 下記の注記を参照<br> |
| 1408 | + doautocmd java_spotbugs_post ShellCmdPost " XXX: (a)<br> |
| 1409 | + let g:spotbugs_compilation_done = 1<br> |
| 1410 | + else<br> |
| 1411 | + cc<br> |
| 1412 | + endif<br> |
| 1413 | + endfunction<br> |
| 1414 | +<br> |
| 1415 | + function! GenericPreCompilerTestCommand(arguments) abort<br> |
| 1416 | + if !exists('g:spotbugs_test_compilation_done')<br> |
| 1417 | + doautocmd java_spotbugs_post User<br> |
| 1418 | + execute 'make ' . a:arguments<br> |
| 1419 | + " :make が同期している場合にのみ doautocmd を実行する。<br> |
| 1420 | + " 下記の注記を参照<br> |
| 1421 | + doautocmd java_spotbugs_post ShellCmdPost " XXX: (b)<br> |
| 1422 | + let g:spotbugs_test_compilation_done = 1<br> |
| 1423 | + else<br> |
| 1424 | + cc<br> |
| 1425 | + endif<br> |
| 1426 | + endfunction<br> |
| 1427 | +<br> |
| 1428 | + let g:spotbugs_properties = {<br> |
| 1429 | + \ <span class="MissingTag">'compiler'</span>: <span class="MissingTag">'maven'</span>,<br> |
| 1430 | + \ 'DefaultPreCompilerCommand':<br> |
| 1431 | + \ function('GenericPreCompilerCommand'),<br> |
| 1432 | + \ 'DefaultPreCompilerTestCommand':<br> |
| 1433 | + \ function('GenericPreCompilerTestCommand'),<br> |
| 1434 | + \ 'PostCompilerActionExecutor':<br> |
| 1435 | + \ function('GenericPostCompilerActionExecutor'),<br> |
| 1436 | + \ }<br> |
| 1437 | +<br> |
| 1438 | +<a class="Comment" href="quickfix.html#:make">:make</a> に相当するコマンドが非同期実行が可能で <a class="Comment" href="autocmd.html#ShellCmdPost">ShellCmdPost</a> イベントを消費で<br> |
| 1439 | +きる場合、非ブロッキング実行の順序を維持するために<br> |
| 1440 | +<span class="Comment">:doautocmd java_spotbugs_post ShellCmdPost</span> をそのような "*Action" (または<br> |
| 1441 | +"*Command") 実装 (つまり、リストされている例の <span class="Comment">(a)</span> と <span class="Comment">(b)</span> の行) から削除<br> |
| 1442 | +し、通知 (以下を参照) を抑制する必要がある。<br> |
| 1443 | +<a class="Comment" href="autocmd.html#ShellCmdPost">ShellCmdPost</a> <a class="Comment" href="autocmd.html#:autocmd">:autocmd</a> は、その名前を "augroupForPostCompilerAction" キーに<br> |
| 1444 | +割り当てることで、任意の <a class="Identifier" href="autocmd.html#:augroup">:augroup</a> に関連付けることができる。<br> |
| 1445 | +<br> |
1382 | 1446 | デフォルトのアクションが目的のワークフローに適していない場合は、任意の関数を自<br> |
1383 | 1447 | 分で記述し、その Funcref をサポートされているキー "PreCompilerAction"、<br> |
1384 | 1448 | "PreCompilerTestAction"、および "PostCompilerAction" に一致させて続行する。<br> |
|
0 commit comments