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

using projectService.setHostConfiguration in a plugin is invalid #61302

Open
mlgq opened this issue Feb 27, 2025 · 0 comments · May be fixed by #61303
Open

using projectService.setHostConfiguration in a plugin is invalid #61302

mlgq opened this issue Feb 27, 2025 · 0 comments · May be fixed by #61303

Comments

@mlgq
Copy link

mlgq commented Feb 27, 2025

🔎 Search Terms

enable plugin
setHostConfiguration

🕗 Version & Regression Information

This is the behavior in every version I tried, and I reviewed the FAQ for entries about typescript plugin

export = function init(modules: { typescript: typeof TS }) {
    return {
        create(info: TS.server.PluginCreateInfo) {
            // @ts-expect-error: access private property
            if (!info.project.projectService.hostConfiguration.extraFileExtensions.some(o => o.extension === ".ext")) {
                info.project.projectService.setHostConfiguration({
                    extraFileExtensions: [
                        {
                            extension: ".ext",
                            isMixedContent: false,
                            scriptKind: modules.typescript.ScriptKind.Deferred
                        }
                    ]
                })
            }
            return info.languageService
        }
    }
}

🙁 Actual behavior

The language service should add files with the ext extension to the project

🙂 Expected behavior

The file with the ext extension was not added to the project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant