https://github.com/milly/ddc-unprintable
Development ddc.vim helpers that allow you to paste word-kind sources gathering unprintable characters.
https://github.com/milly/ddc-unprintable
ddc-vim vim-denops
Last synced: 10 months ago
JSON representation
Development ddc.vim helpers that allow you to paste word-kind sources gathering unprintable characters.
- Host: GitHub
- URL: https://github.com/milly/ddc-unprintable
- Owner: Milly
- License: mit
- Created: 2022-12-07T09:22:02.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2025-07-21T01:21:33.000Z (11 months ago)
- Last Synced: 2025-07-30T16:33:35.229Z (10 months ago)
- Topics: ddc-vim, vim-denops
- Language: TypeScript
- Homepage: https://jsr.io/@milly/ddc-unprintable
- Size: 52.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ddc-unprintable
[](LICENSE)
[](https://jsr.io/@milly/ddc-unprintable)
_ddc-unprintable_ is helper library for [ddc.vim] sources in [Denops]. This
module contains helpers that allow you to paste word-kind sources gathering
unprintable characters.
[ddc.vim]: https://github.com/Shougo/ddc.vim
[Denops]: https://github.com/vim-denops/denops.vim
## Usage
1. Instantiate `Unprintable` class in your ddc source.
2. Call `onInit()` in your `Source.onInit()` method to initialize instance.
3. Call `convertItems()` in your `Source.gather()` method to process completion
items.
4. Call `onCompleteDone()` in your `Source.onCompleteDone()` method to restore
the original text.
Example of using this module in your source:
```ts
import { Unprintable, UnprintableUserData } from "jsr:@milly/ddc-unprintable";
import {
BaseSource,
type GatherArguments,
type OnCompleteDoneArguments,
type OnInitArguments,
} from "jsr:@shougo/ddc-vim/source";
import type { Item } from "jsr:@shougo/ddc-vim/types";
interface MyParams extends Record {
// Add your source parameters here
}
interface MyUserData extends UnprintableUserData {
// Add your user data properties here
}
type MyItem = Item;
export class Source extends BaseSource {
// 1. Instantiate this class.
#unprintable = new Unprintable();
override params(): MyParams {
return {};
}
override async onInit(args: OnInitArguments): Promise {
// 2. Call `onInit()`.
await this.#unprintable.onInit(args);
}
override async gather(
args: GatherArguments,
): Promise {
const myItems: MyItem[] = [
// Generate your items here.
];
// 3. Call `convertItems()`.
const convertedItems = await this.#unprintable!.convertItems(
args.denops,
myItems,
args.context.nextInput,
);
return convertedItems;
}
override async onCompleteDone(
args: OnCompleteDoneArguments,
): Promise {
// 4. Call `onCompleteDone()`.
await this.#unprintable.onCompleteDone(args);
}
}
```
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file
for details.