-
Notifications
You must be signed in to change notification settings - Fork 12
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
Itembox Implementation #63
Conversation
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.
I agree with @matthijseikelenboom this should be in the CESE repo.
We discussed briefly what it should be called, and I think you're right that it could be used for other things in the future but calling it CompletionWindow
would be fine in that package. It can be extended later but we can avoid that complexity for now.
Also if you move it, you should be able to add the keybind you have in CE right now to the existing keybind handler in CESE. That might fix the issue you mentioned with not being able to close tabs. You'd then also have access to the theme colors for styling this window.
// | ||
|
||
import AppKit | ||
import LanguageServerProtocol |
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.
Instead of using the CompletionItem
type from the LSP library, this should define a protocol for completion items.
} | ||
|
||
/// Padding at top and bottom of the window | ||
let WINDOW_PADDING: CGFloat = 5 |
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.
This should be a private variable, or a static variable on the window controller.
} | ||
} | ||
|
||
class NoSlotScroller: NSScroller { |
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.
Move this to a separate file.
} | ||
} | ||
|
||
public protocol ItemBoxDelegate: AnyObject { |
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.
This should also be in it's own file
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.
Amazing! I was wondering if it is necessary to add this functionality here or rather in CESE, what do you think?
NotificationCenter.default.addObserver( | ||
self, | ||
selector: #selector(parentWindowDidResignKey), | ||
name: NSWindow.didResignKeyNotification, | ||
object: parentWindow | ||
) |
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.
Not removing the observer could lead to retain cycles or redundant notifications.
} | ||
|
||
/// Padding at top and bottom of the window | ||
let WINDOW_PADDING: CGFloat = 5 |
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.
We're a bit inconsistent with this. Here you declared the constant with capital letters and in the extension you have constants declared normally, within the class and in lowercase.
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.
Like I said In Discord, I'd suggest changing the name "ItemBox" to something more clearer. Other than the comments left by the other guys, I think it looks good
Description
Adds the ItemBox component, which is used for the auto complete feature.
Related Issues
Checklist
Screenshots