Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mgerzabek opened this issue Nov 28, 2023 · 4 comments · Fixed by #1442
Closed

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

mgerzabek opened this issue Nov 28, 2023 · 4 comments · Fixed by #1442
Labels
Help wanted Looking for help.

Comments

@mgerzabek
Copy link

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.

@yzhang-gh
Copy link
Owner

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.

@madmini
Copy link
Contributor

madmini commented Jun 14, 2024

I can confirm this workaround fixes the issue in Theia IDE 1.50.100: no error message, extension loads and mostly works. Could you add the null check anyway? It seems Theia is still missing search.exclude (but has files.exclude). see eclipse-theia/theia#7273 (comment)

Note that Theia IDE (formerly also Theia Blueprint) is the VSCode alternative of the Eclipse Foundation, not the Eclipse IDE.
For information on extension support in Theia see https://theia-ide.org/docs/user_install_vscode_extensions/#compatibility.

@madmini
Copy link
Contributor

madmini commented Jun 14, 2024

With the workaround some stuff is still broken:

  • all actions (except batch html conversion) are missing from the palette, but it seems most of the functionality is still there:
    • the batch html conversion works perfectly
    • table of content creation is missing, but if one is created in vscode, it is detected and properly updated in Theia
  • pasting links produces console error Command with id 'editor.action.insertSnippet' is not registered. I believe this is because Theia does not support snippets yet. (see Code snippets/template as in Eclipse eclipse-theia/theia#3686)
  • there are two Open Preview to the Side buttons; one of them opens the stock markdown preview while the other opens the correct (from this extension) preview

Everything else I have tested so far has worked perfectly!

@yzhang-gh
Copy link
Owner

Hi, thanks for the information. Would you minding opening a PR for the null check? It should be very simple but I would like to also add a few comments about Eclipse Theia along with the code change and I believe you definitely have more context than me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help wanted Looking for help.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants