Skip to content

Commit

Permalink
Add useExisting
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed Aug 3, 2023
1 parent ac13709 commit 6f8038f
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions denops/ddu/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,11 @@ export type NoFilePreviewer = {
contents: string[];
} & PreviewerCommon;

/**
* Preview type which shows the contents of files or existing buffers
*/
export type BufferPreviewer = {
type BufferPreviewerBase = {
kind: "buffer";
} & PreviewerCommon;

type NewBufferPreviewer = {
/**
* Buffer expression, which is the same as the arguments of `bufname()`
*/
Expand All @@ -312,7 +311,27 @@ export type BufferPreviewer = {
* Path of file to preview
*/
path?: string;
} & PreviewerCommon;

useExisting?: false;
};

type ExistingBufferPreviewer = {
expr: number | string;

path?: undefined;

/**
* Use existing buffer
*/
useExisting: true;
};

/**
* Preview type which shows the contents of files or existing buffers
*/
export type BufferPreviewer =
& BufferPreviewerBase
& (NewBufferPreviewer | ExistingBufferPreviewer);

type PreviewerCommon = {
/**
Expand Down

0 comments on commit 6f8038f

Please sign in to comment.