Файли
openidea/src/platform/keymaps/eclipse-macos.ts
T
LU XIANGRUIтаwildcatDownstairs 52096fc904 feat(python): add Smart Type completion (#5351)
Ctrl+Shift+Space now runs **Smart Type** completion in Python files (Code › Code Completion › Smart Type, `code.smartTypeCompletion`): the lookup keeps the items whose type fits the caret's expected type, with that type in the right-hand column. basedpyright's completion items carry no type, so the candidates are resolved and their type is read from the documentation's code block.
The expected type comes from the active parameter's annotation (signature help), an annotated assignment `x: T = |`, or the enclosing function's `-> T` for `return |` (also in `async def`). A member access being typed (`x: T = task.|`, `return self.|`) is skipped over to find it. Keywords and comparisons are not taken for an assignment (`else: x = |`, `ok: bool = a <= |`).
An item fits when each member of its type's union fits the expected union:
- types are compared in a canonical form: module prefixes dropped, `typing` aliases lowered, `Optional` / `Union` and spacing read alike (`List[Optional[int]]` is `list[int | None]`);
- numbers are promoted as PEP 484 says: `float` accepts `int`, `complex` accepts both, and `bool` counts as an `int`;
- a class fits as any of its bases, from the project's classes (`Dog` for `Animal`);

Co-authored-by: wildcatDownstairs <[email protected]>
2026-11-24 08:38:28 +08:00

175 рядки
6.3 KiB
TypeScript

/**
* Eclipse preset inheriting Mac OS X 10.5+, with explicit removals preserved.
* Source: JetBrains/intellij-community@74dbd42b7a8787b0707437cb857c68e78199f611
* plugins/keymaps/eclipse-keymap/resources/keymaps/Eclipse (Mac OS X).xml
*/
import { intellijMacos } from "./intellij-macos";
export const eclipseMacos: Record<string, string[]> = {
...intellijMacos,
"agents.focusInput": ["Meta+L"],
"agents.cycleEffort": ["Alt+T"],
// $Undo / $Redo stay unbound as in the parent keymap: the focused editor or view handles them.
"code.autoIndentLines": ["Meta+I"],
"navigate.back": ["Meta+[", "Button4", "SwipeRight"],
"refactor.changeSignature": ["Alt+Meta+C"],
"db.modifyTable": ["Alt+Meta+C"],
"vcs.commit": [],
// Eclipse gives ⌃⇧Space to Parameter Info / Quick Documentation.
"code.smartTypeCompletion": [],
"editor.closeTab": ["Meta+W"],
"toolwindow.closeContent": ["Meta+W"],
"editor.closeAllTabs": ["Meta+Shift+W"],
"analyze.inspectFile": [],
"project.collapseAll": ["Meta+Shift+NumpadDivide"],
"run.collapseAllTests": ["Meta+Shift+NumpadDivide"],
"code.foldAll": ["Meta+Shift+NumpadDivide"],
"code.fold": ["Meta+NumpadSubtract"],
"code.commentBlock": ["Shift+Meta+/"],
"build.buildProject": ["Meta+B"],
"project.copyElement": [],
"project.delete": ["Meta+Backspace"],
"run.debug": ["Meta+F11"],
"project.open": ["F3"],
"debug.jumpToSource": ["F3"],
"diff.jumpToSource": ["F3"],
"find.popup.openResult": ["F3"],
"editor.codeBlockEnd": ["Ctrl+]", "Shift+Ctrl+P"],
"code.deleteLine": ["Meta+D"],
"code.duplicateLine": [],
"code.extendSelection": ["Shift+Ctrl+Up"],
"code.toggleCase": ["Shift+Meta+X", "Shift+Meta+Y"],
"code.shrinkSelection": ["Shift+Ctrl+Down"],
"debug.evaluate": ["Meta+U"],
"project.expandAll": ["Meta+Shift+NumpadMultiply"],
"run.expandAllTests": ["Meta+Shift+NumpadMultiply"],
"code.unfoldAll": ["Meta+NumpadMultiply"],
"code.unfold": ["Meta+NumpadAdd"],
"code.expandAllToLevel1": [],
"code.expandAllToLevel2": [],
"code.expandAllToLevel3": [],
"code.expandAllToLevel4": [],
"code.expandAllToLevel5": [],
"code.expandToLevel1": [],
"code.expandToLevel2": [],
"code.expandToLevel3": [],
"code.expandToLevel4": [],
"code.expandToLevel5": [],
"refactor.extractMethod": ["Meta+Alt+M"],
"navigate.fileStructure": ["Meta+O"],
// ⌘R runs to the cursor: no Reload Page default on it.
"db.reloadPage": [],
"db.goToColumn": ["Meta+O"],
"find.inFile": [],
"find.inPath": ["Ctrl+H"],
"find.next": ["Meta+K"],
// The parent's Push binding would shadow Find Previous whenever a repository is open.
"vcs.push": [],
"find.previous": ["Meta+Shift+K"],
"find.popup.nextResult": ["Meta+K"],
"find.popup.previousResult": ["Shift+Meta+K"],
"find.usages": ["Meta+Shift+G"],
"project.findUsages": ["Meta+Shift+G"],
"navigate.forward": ["Meta+]", "Button5", "SwipeLeft"],
"navigate.gotoTest": [],
"navigate.gotoClass": ["Shift+Meta+T"],
"navigate.declaration": ["F3"],
"db.goToDdl": ["F3"],
"navigate.gotoFile": ["Shift+Meta+R"],
"navigate.implementation": [],
"navigate.gotoLine": ["Meta+L"],
"navigate.nextError": ["Meta+."],
"navigate.prevError": ["Meta+Shift+."],
"navigate.superMethod": [],
"navigate.typeDeclaration": [],
"find.highlightUsages": [],
"code.implementMethods": [],
"refactor.inline": ["Meta+Alt+I"],
"code.insertLiveTemplate": [],
"refactor.extractConstant": [],
"refactor.extractVariable": ["Meta+Alt+L"],
"navigate.lastEditLocation": ["Ctrl+Q"],
"toolwindow.jumpToLast": [],
"navigate.nextHighlightedUsage": [],
"navigate.nextMethod": ["Ctrl+Alt+Down"],
"navigate.prevHighlightedUsage": [],
"navigate.previousMethod": ["Ctrl+Alt+Up"],
"refactor.move": ["Meta+Alt+V"],
"project.move": ["Meta+Alt+V"],
"code.moveStatementDown": ["Alt+Down"],
"code.moveStatementUp": ["Alt+Up"],
"diff.nextDifference": ["Ctrl+F7"],
"diff.prevFile": [],
"diff.nextFile": [],
"diff.focusOppositePane": [],
"navigate.nextOccurrence": [],
"editor.nextTab": ["Meta+F6", "Meta+Alt+Right"],
"db.nextResultTab": ["Meta+F6", "Meta+Alt+Right"],
"code.optimizeImports": ["Shift+Meta+O"],
"project.optimizeImports": ["Shift+Meta+O"],
"code.overrideMethods": [],
"code.parameterInfo": ["Ctrl+Shift+Space"],
"code.expressionTypeInfo": [],
"navigate.prevOccurrence": [],
"editor.prevTab": ["Shift+Meta+F6", "Meta+Alt+Left"],
"db.previousResultTab": ["Shift+Meta+F6", "Meta+Alt+Left"],
"code.quickDocumentation": ["F2"],
"db.quickDoc": ["F2"],
"localHistory.recentChanges": [],
"db.reformatValue": ["Shift+Meta+F"],
"db.findInValue": [],
"code.reformat": ["Shift+Meta+F"],
"project.reformatCode": ["Shift+Meta+F"],
"code.unwrap": [],
"find.replaceInFile": [],
"find.replaceInPath": [],
"run.rerun": [],
"debug.rerun": [],
"find.rerun": [],
"usages.rerun": [],
"debug.resume": ["F8"],
"run.run": ["Meta+Shift+F11"],
"debug.runToCursor": ["Meta+R"],
"code.showIntentions": ["Meta+1"],
"debug.smartStepInto": ["Alt+F5"],
"debug.stepInto": ["F5"],
"debug.forceStepInto": ["Meta+Ctrl+F5"],
"debug.stepOut": ["F7"],
"debug.stepOver": ["F6"],
"debug.forceStepOver": ["Meta+Ctrl+F6"],
"code.surroundWith": ["Meta+Alt+Z"],
// ⌥⌘Z is Surround With here, not the table editor's Revert.
"db.revertChanges": [],
"file.reloadFromDisk": [],
"project.reloadFromDisk": [],
"navigate.toggleBookmark": [],
"vcs.log.toggleBookmark": [],
"vcs.log.toggleBookmarkWithMnemonic": [],
"vcs.log.editMessage": [],
"debug.toggleBreakpoint": ["Shift+Meta+B"],
"navigate.typeHierarchy": ["F4"],
"vcs.update": [],
"navigate.navigationBar": ["Alt+Meta+B"],
"code.moveLineDown": [],
"code.moveLineUp": [],
"code.cyclicExpandWord": ["Ctrl+."],
"code.cyclicExpandWordBackward": [],
"refactor.safeDelete": [],
"navigate.selectIn": ["Alt+Meta+W"],
"navigate.findAction": ["Meta+3"],
"vcs.rollback": ["Ctrl+Shift+Alt+Z"],
"toolwindow.project": [],
"toolwindow.bookmarks": [],
"toolwindow.find": ["Alt+Meta+Q S"],
"code.foldSelection": [],
"code.collapseBlock": [],
"navigate.showFilePath": [],
"toolwindow.services": ["Alt+Meta+H"],
"toolwindow.resizeLeft": [],
"toolwindow.resizeRight": [],
"toolwindow.resizeUp": [],
"toolwindow.resizeDown": [],
"editor.decreaseFontSize": ["Meta+-"],
"editor.increaseFontSize": ["Meta+="],
};