Conversation
thecoolwinter
left a comment
There was a problem hiding this comment.
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.
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.
This should be a private variable, or a static variable on the window controller.
| } | ||
| } | ||
|
|
||
| class NoSlotScroller: NSScroller { |
There was a problem hiding this comment.
Move this to a separate file.
| } | ||
| } | ||
|
|
||
| public protocol ItemBoxDelegate: AnyObject { |
There was a problem hiding this comment.
This should also be in it's own file
tom-ludwig
left a comment
There was a problem hiding this comment.
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.
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.
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.
matthijseikelenboom
left a comment
There was a problem hiding this comment.
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