Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type Annotations? #33

Open
katlyn-edwards opened this issue Jul 25, 2019 · 4 comments
Open

Type Annotations? #33

katlyn-edwards opened this issue Jul 25, 2019 · 4 comments

Comments

@katlyn-edwards
Copy link
Contributor

Hey there!

I've been making a few contributions, and think it'd be really helpful to have some form of type annotations.

For example: https://github.com/brijeshb42/monaco-vim/blob/master/src/statusbar.js#L31
options here is actually a pretty complex object:
@param {{

  • bottom: boolean,
  • desc: string,
  • onKeyDown: function,
  • onKeyUp: function(),
  • onClose: function(),
  • prefix: string,
  • selectValueOnOpen: boolean}} options,
  • value: string,
  • }};

Happy to help either add Closure style annotations, or to migrate to TypeScript.

@brijeshb42
Copy link
Owner

Will be possible for top level exports but I don't think it will be possible for the actual vim wrapper itself.

@karuifeather
Copy link

So are we getting anywhere with this?

@thien-do
Copy link
Contributor

thien-do commented Aug 26, 2021

Let's start! I have this already in my source code, will expand to defineEx soon:

declare module "monaco-vim" {
	export interface EditorVimMode {
		dispose: () => void;
	}

	type initVimModeFn = (
		editor: monaco.editor.IStandaloneCodeEditor,
		statusElm: HTMLElement
	) => EditorVimMode;

	const initVimMode: initVimModeFn;
	export { initVimMode };

	const VimMode: {
		Vim: {
			noremap: (from: string, to: string) => void;
			map: (from: string, to: string, mode: string) => void;
		};
	};
	export { VimMode };
}

Now @brijeshb42 do you want to have the type out of the box or do you want us to publish to @types/monaco-vim ?

@brijeshb42
Copy link
Owner

It'd be better to have in this repo itself to avoid installing extra package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants