vscode-markdown icon indicating copy to clipboard operation
vscode-markdown copied to clipboard

Extension not activated when there is no `search.exclude` in settings.json

Open mgerzabek opened this issue 8 months ago • 1 comments

What's the problem

I integrated the extension into Eclipse Theia. After launching I got the error message Activating extension 'Markdown All in One' failed: Cannot convert undefined or null to object and the extension was not actived.

What's the expected result

The extension should activate also with empty (null, undefined) search.exclude pattern.

How to reproduce

  1. Download Eclipse Theia Blueplrint
  2. Add the extension markdown-all-in-one to package.json, copy "markdown-all-in-one": "https://open-vsx.org/api/yzhang/markdown-all-in-one/3.5.1/file/yzhang.markdown-all-in-one-3.5.1.vsix", into the theiaPlugins section.
  3. Run yarn && yarn build:dev && yarn download:plugins followed by yarn electron package
  4. Run yarn electron package:preview

Other information

The problem is in the constructor of MdCompletionItemProvider in the block where the exclude patterns are constructed.

const Always_Exclude = ["**/node_modules", "**/bower_components", "**/*.code-search", "**/.git"];
        const excludePatterns = new Set(Always_Exclude);
        if (manager_1.configManager.get("completion.respectVscodeSearchExclude", folder)) {
            const vscodeSearchExclude = manager_1.configManager.getByAbsolute("search.exclude", folder);
            for (const [pattern, enabled] of Object.entries(vscodeSearchExclude)) {
                if (enabled) {
                    excludePatterns.add(pattern);
                }
            }
        }

manager_1.configManager.getByAbsolute("search.exclude", folder) returns undefined and then the for() breaks.

mgerzabek avatar Nov 28 '23 08:11 mgerzabek

Thanks for the feedback. Never know there is a way to run this inside Eclipse 😲.

Can you change your settings somewhere so that the completion.respectVscodeSearchExclude is false? I can add a simple null check here but in general this extension only targets vscode, so there might be more vscode-related incompatibility in Eclipse.

yzhang-gh avatar Dec 01 '23 13:12 yzhang-gh