File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,17 +52,17 @@ export type Plugin = {
5252 extAttrs ?: unknown ;
5353 external_commands ?: string | string [ ] ;
5454 ftplugin ?: Record < string , string > ;
55+ group ?: string | string [ ] ;
5556 hook_add ?: string ;
5657 hook_depends_update ?: string ;
5758 hook_done_update ?: string ;
59+ hook_post_check_update ?: string ;
5860 hook_post_source ?: string ;
5961 hook_post_update ?: string ;
6062 hook_pre_update ?: string ;
61- hook_post_check_update ?: string ;
6263 hook_source ?: string ;
6364 hooks_file ?: string | string [ ] ;
6465 if ?: boolean | string ;
65- group ?: string | string [ ] ;
6666 lazy ?: boolean ;
6767 local ?: boolean ;
6868 lua_add ?: string ;
@@ -92,3 +92,14 @@ export type Plugin = {
9292 sourced ?: boolean ;
9393 url ?: string ;
9494} ;
95+
96+ export const Hooks : Set < string > = new Set ( [
97+ "add" ,
98+ "depends_update" ,
99+ "done_update" ,
100+ "post_check_update" ,
101+ "post_source" ,
102+ "post_update" ,
103+ "pre_update" ,
104+ "source" ,
105+ ] ) ;
Original file line number Diff line number Diff line change 1- import type { Plugin } from "./types.ts" ;
1+ import { Hooks , type Plugin } from "./types.ts" ;
22
33import type { Denops } from "@denops/std" ;
44
@@ -186,12 +186,15 @@ export function parseHooksFile(
186186 nestedCount ++ ;
187187
188188 hookName = match . groups . hookName ;
189- if (
190- hookName . startsWith ( "hook_" ) ||
191- hookName . startsWith ( "lua_" )
192- ) {
193- dest = options ;
194- } else {
189+ if ( hookName . startsWith ( "hook_" ) || hookName . startsWith ( "lua_" ) ) {
190+ // Check Hooks.
191+ const checkHook = hookName . replace ( / ^ h o o k _ | ^ l u a _ / , "" ) ;
192+ if ( Hooks . has ( checkHook ) ) {
193+ dest = options ;
194+ }
195+ }
196+
197+ if ( ! dest ) {
195198 // Use ftplugin
196199 dest = ftplugin ;
197200 }
@@ -411,8 +414,9 @@ Deno.test("parseHooksFile", () => {
411414 "-- }}}" ,
412415 ] ) ,
413416 {
414- lua_hoge : "piyo" ,
415- ftplugin : { } ,
417+ ftplugin : {
418+ lua_hoge : "piyo" ,
419+ } ,
416420 } ,
417421 ) ;
418422} ) ;
You can’t perform that action at this time.
0 commit comments