始终在 monaco-editor 中显示 "Show more" 部分

Always show the "Show more" section in monaco-editor

我正在使用来自 monaco editor playground 的 Configure javascript defaults 示例。

https://microsoft.github.io/monaco-editor/playground.html#extending-language-services-configure-javascript-defaults

当我开始输入预定义的 class 时,我会自动完成,但我需要按一次 ctl+space 才能查看建议的实际文档。

有没有办法默认设置此选项,以便自动完成功能会默认显示打开的文档?

这是我在代码中唯一更改的地方:

monaco.languages.typescript.typescriptDefaults.addExtraLib([
  '/**',
  ' * Know your facts!',
  ' */',
  'declare class Facts {',
  '    /**',
  '     * Returns the next fact',
  '     */',
  '    static next():string',
  '}',
].join('\n'), 'filename/facts.d.ts');

如何打开现在

我如何让它默认打开:

以防万一有人仍然想知道:作为一种解决方法,您可以实施自己的存储服务,该服务(除其他外)也将用于查询建议扩展的当前偏好。

monaco.editor.create(document.getElementById("container"), {
    value: jsCode,
    language: "javascript"
}, {
    storageService: {
        get() {},
        getBoolean(key) {
            if (key === "expandSuggestionDocs")
                return true;

            return false;
        },
        remove() {},
        store() {},
        onWillSaveState() {},
        onDidChangeStorage() {}
    }
});

存储服务还用于记住最近使用的建议(以个性化 IntelliSense)等,因此如果您需要该功能,您可能还想实现其他功能。 IStorageService.

描述了每个方法应该做什么的完整界面。