-
Notifications
You must be signed in to change notification settings - Fork 52
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
feat(api): Implement Extmark API #199
Conversation
Is this generated? We should avoid manually writing interfaces that just map to |
No, it was hand-written. I agree that generating APIs from I think it is a bit challenging to generate APIs. For example,
|
Why don't we stick to the API names exactly? TypeScript "conventions" are not that important IMO. |
Since using |
OK, I'll make a new issue for generating sources. Can we merge this PR at first? Then let me try to make some mechanism of code generation. (Though I'm not sure when I can take time to do it) |
This doesn't sound like a blocker. Just type the items as I think we should strictly stick with auto-generation if we're going to provide anything beyond |
Will we be able to remove this later once auto-generation is in place? That might be a breaking change. |
I think yes. Because the auto generated sources will break many other existing APIs. So taking care about only the Extmark API doesn't make much sense. |
why? we already were generating stuff in the past: https://github.com/neovim/node-client/blob/master/packages/neovim/bin/generate-typescript-interfaces.js |
If my understanding is correct, this script is no longer used. The script was used before large changes by @billyvg. Actually, as far as I ran the script on my local machine now, it only outputs 24 lines: $ node ./bin/generate-typescript-interfaces.js [Husky.local][10/13 21:56]
interface AttachOptions {
writer?: NodeJS.WritableStream,
reader?: NodeJS.ReadableStream,
proc?: NodeJS.ChildProcess,
socket?: String,
}
export default function attach(options: AttachOptions): Neovim;
export interface Neovim extends NodeJS.EventEmitter {
quit(): void;
isApiReady(): Boolean;
requestApi(): Promise<[integer, any]>;
equals(rhs: Neovim): boolean;
}
export interface Buffer {
equals(rhs: Buffer): boolean;
}
export interface Window {
equals(rhs: Window): boolean;
}
export interface Tabpage {
equals(rhs: Tabpage): boolean;
} |
For example, this type has information more than the output from node-client/packages/neovim/src/api/Neovim.ts Lines 72 to 125 in 635b642
|
Yeah I don't think we can 100% rely on autogeneration, but it'd be good to do so in order to keep up with neovim. @rhysd did your code comments on the PR come from neovim or were they written by you? re: camelcase vs snake, imo we should follow node/ts conventions which is generally camelCase. |
* @param {ExtmarkPosition} start Start of range: a 0-indexed (row, col) or valid extmark id | ||
* (whose position defines the bound). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param {ExtmarkPosition} start Start of range: a 0-indexed (row, col) or valid extmark id | |
* (whose position defines the bound). | |
* @param {ExtmarkPosition} start Start of range: a 0-indexed (row, col) or valid extmark id (whose position defines the bound). |
* @param {ExtmarkPosition} end End of range (inclusive): a 0-indexed (row, col) or valid | ||
* extmark id (whose position defines the bound). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param {ExtmarkPosition} end End of range (inclusive): a 0-indexed (row, col) or valid | |
* extmark id (whose position defines the bound). | |
* @param {ExtmarkPosition} end End of range (inclusive): a 0-indexed (row, col) or valid extmark id (whose position defines the bound). |
* @param {BufferGetExtmarksOptions} options Optional parameters. Keys: | ||
* • limit: Maximum number of marks to return | ||
* • details: Whether to include the details dict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param {BufferGetExtmarksOptions} options Optional parameters. Keys: | |
* • limit: Maximum number of marks to return | |
* • details: Whether to include the details dict | |
* @param {BufferGetExtmarksOptions} options Optional parameters. Keys: | |
* • limit: Maximum number of marks to return | |
* • details: Whether to include the details dict |
* @param {Number} ns_id Namespace id from |nvim_create_namespace()| | ||
* @param {Number} id Extmark id | ||
* @param {BufferGetExtmarkOptions} options Optional parameters. Keys: | ||
* • details: Whether to include the details dict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* • details: Whether to include the details dict | |
* • details: Whether to include the details dict |
It's still not clear why this is needed. #170 isn't blocked because nodejs clients can do So why rush a hand-crafted API which we won't be able to revert later (breaking change)? Why not work on generating an API instead? What is blocking that? We generate all kinds of APIs in Nvim, is there a technical issue with doing that for nodejs client? |
This repo has lacked maintainer activity for 6+ months, which supports the point I made above about wanting to aggressively minimize the maintenance needed for this project.
|
Fix #170
This PR adds Extmark API binding to
Buffer
. I confirmed it worked on my local:Output: