Skip to content

using projectService.setHostConfiguration in a plugin is invalid #61302

Closed as not planned
@mlgq

Description

@mlgq

🔎 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Won't FixThe severity and priority of this issue do not warrant the time or complexity needed to fix it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions