Skip to content

modules 和 constants 的命名区分 #475

Description

@wewoor

我们可以把 modules 和 constants 的命名区分下,不然会看起来比较奇怪,这里会怀疑获取的是一个不同的 Constant

Originally posted by @wewoor in #471 (comment)

Activity

  1. added this to the 0.9.0-alpha.6 milestone on Oct 21, 2021
  2. mortalYoung commented on Oct 21, 2021

    @mortalYoung
    Collaborator

    另外需要优化的点在于,需要把 modules 做细分,例如有部分的 modules 是以 [xxx,xxx] 作为一个整体的,而我们如果想要禁用某一个 xxx 则会比较困难,需要对其做拆分,会有利于后续禁用内置模块

  3. mortalYoung commented on Oct 26, 2021

    @mortalYoung
    Collaborator

    modules 和 constants 命名如下:

    • constants 键命名特点:大写、下划线分割、以功能模块起始,如:EXPLORER_ACTIVITY_ITEM、EDITOR_MENU_CLOSE_ALL
    • constants 值命名规则:小写为主,部分以小驼峰法命名、以 . 分割、以功能模块起始,如:editor.closeAll、sidebar.explore.saveALL
    • modules 键命名特点:以小写为主,部分以小驼峰法命名,以 . 作为分割,如:menu.file.open

    看一哈 cc @wewoor

  4. wewoor commented on Oct 26, 2021

    @wewoor
    CollaboratorAuthor

    没太看懂 modules 部分的命名,如果是下面的这个例子:

     const { ROOT_FOLDER_CONTEXT_MENU } = this.builtinService.getModules();
     const { folder.context.menu } = this.builtinService.getModules();

    命名是怎样的

  5. mortalYoung commented on Oct 26, 2021

    @mortalYoung
    Collaborator

    考虑如下:

    • 在 builtinService 中注册 ExplorerRegister PanelRegister MenuRegister ActionRegister ContextMenuRegister,目前暂时想到这几个,后续待补充
    • 在这些 register 中注册相关的内置模块,而用户可以通过 molecule.builtin.explorer.inactive() molecule.builtin.menu.inactive() 来禁用相关的内置模块

    cc @wewoor

  6. locked and limited conversation to collaborators on Mar 4, 2022
  7. converted this issue into a discussion #687 on Mar 4, 2022
  8. removed this from the 0.9.0-beta.4 milestone on Apr 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions