Skip to content

Commit

Permalink
Export ContextBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed Dec 31, 2024
1 parent 54248fb commit 29e5f94
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions denops/ddu/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type {
} from "./types.ts";
import { Ddu } from "./ddu.ts";
import {
ContextBuilder,
ContextBuilderImpl,
defaultDduOptions,
foldMerge,
mergeDduOptions,
Expand Down Expand Up @@ -53,7 +53,7 @@ export const main: Entrypoint = (denops: Denops) => {

const loaders: Record<string, Loader> = {};
const ddus: Record<string, Ddu[]> = {};
const contextBuilder = new ContextBuilder();
const contextBuilder = new ContextBuilderImpl();
const clipboard: Clipboard = {
action: "none",
items: [],
Expand Down
3 changes: 1 addition & 2 deletions denops/ddu/base/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { ContextBuilder } from "../context.ts";
import type { DduAliasType } from "../types.ts";
import type { ContextBuilder, DduAliasType } from "../types.ts";
import type { Denops } from "jsr:@denops/std@~7.4.0";

export type ConfigArguments = {
Expand Down
3 changes: 2 additions & 1 deletion denops/ddu/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type {
BaseParams,
ColumnOptions,
Context,
ContextBuilder,
DduOptions,
FilterOptions,
KindOptions,
Expand Down Expand Up @@ -319,7 +320,7 @@ class Custom {
}
}

export class ContextBuilder {
export class ContextBuilderImpl implements ContextBuilder {
#custom: Custom = new Custom();

async get(
Expand Down
10 changes: 10 additions & 0 deletions denops/ddu/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ export type Context = {
winId: number;
};

export interface ContextBuilder {
get(denops: Denops): Promise<[Context, DduOptions]>;
getGlobal(): Partial<DduOptions>;
getLocal(): Record<string, Partial<DduOptions>>;
setGlobal(options: Partial<DduOptions>): void;
setLocal(name: string, options: Partial<DduOptions>): void;
patchGlobal(options: Partial<DduOptions>): void;
patchLocal(name: string, options: Partial<DduOptions>): void;
}

export type DduOptions = {
actionOptions: Record<ActionName, Partial<ActionOptions>>;
actionParams: Record<ActionName, Partial<BaseParams>>;
Expand Down

0 comments on commit 29e5f94

Please sign in to comment.