Skip to content

Commit

Permalink
Add skipMergeFilenamePattern option
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed Aug 21, 2024
1 parent dc26174 commit 042a39b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions denops/dpp/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export function defaultDppOptions(): DppOptions {
protocolOptions: {},
protocolParams: {},
protocols: [],
skipMergeFilenamePattern: "^tags(?:-\w\w)?$|^package.json$",
};
}

Expand Down
10 changes: 8 additions & 2 deletions denops/dpp/dpp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,12 @@ export class Dpp {
//console.log(startupLines);
//console.log(stateLines);

await this.#mergePlugins(denops, dppRuntimepath, recordPlugins);
await this.#mergePlugins(
denops,
dppRuntimepath,
options.skipMergeFilenamePattern,
recordPlugins,
);

// Generate ftplugin files
if (configReturn.ftplugins) {
Expand Down Expand Up @@ -458,6 +463,7 @@ export class Dpp {
async #mergePlugins(
denops: Denops,
dppRuntimepath: string,
skipMergeFilenamePattern: string,
recordPlugins: Record<string, Plugin>,
) {
const hasWindows = await fn.has(denops, "win32");
Expand All @@ -479,7 +485,7 @@ export class Dpp {
}

for await (const entry of Deno.readDir(srcDir)) {
if (entry.name.match(/^tags(?:-\w\w)?$/)) {
if (entry.name.match(skipMergeFilenamePattern)) {
// Skip exists tag file to avoid overwrite
continue;
}
Expand Down
1 change: 1 addition & 0 deletions denops/dpp/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export type DppOptions = {
protocolOptions: Record<ProtocolName, Partial<ExtOptions>>;
protocolParams: Record<ProtocolName, Partial<BaseProtocolParams>>;
protocols: ProtocolName[];
skipMergeFilenamePattern: string;
};

export type UserOptions = Record<string, unknown>;
Expand Down
8 changes: 8 additions & 0 deletions doc/dpp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ protocols (string[])

Default: []

*dpp-option-skipMergeFilenamePattern*
skipMergeFilenamePattern (string)
It is the pattern of skip filename when
|dpp-plugin-option-merged| is set.
NOTE: It must be TypeScript regexp.

Default: "^tags(?:-\w\w)?$|^package.json$"

------------------------------------------------------------------------------
FUNCTIONS *dpp-functions*

Expand Down

0 comments on commit 042a39b

Please sign in to comment.