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

Writing-a-Language-Service-Plugin recommends local testing which does not appear possible anymore #47149

Closed
MarcCelani-at opened this issue Dec 14, 2021 · 2 comments
Assignees
Labels
Docs The issue relates to how you learn TypeScript

Comments

@MarcCelani-at
Copy link

Bug Report

In the Writing-a-Language-Service-Plugin doc, it is recommended that you test locally:

To locally test your plugin, set up a sample project and give it the path to your plugin in the tsconfig.json file. For example:

your_plugin/index.ts
your_plugin/index.js (compiled by tsc)
sample_project/tsconfig.json
where sample_project/tsconfig.json contains

{
"compilerOptions": {
"plugins": [{
"name": "../your_plugin",
}]
}
}

When I attempted to do this, my plugin does not load. I get this error:

Info 24   [11:40:45.666] Enabling plugin ./ts_lang_datadog_reporter from candidate paths: <redacted>
Info 25   [11:40:45.666] Skipped loading plugin ./ts_lang_datadog_reporter because only package name is allowed plugin name

It appears that the option to load a plugin locally was disabled in #42713 but there was no follow up to update the documentation. Is this a bug on my side, or is the documentation out of date?

🔎 Search Terms

Writing-a-Language-Service-Plugin language service plugin

🕗 Version & Regression Information

  • I was unable to test this on prior versions because going backwards to old typescript versions in my project is extremely challenging

💻 Code

cat tsconfig.base.json
...
        "plugins": [
            {
                "name": "./ts_lang_datadog_reporter"
            }
        ]
...


ls ts_lang_datadog_reporter
ts_lang_datadog_reporter/tsconfig.json
ts_lang_datadog_reporter/index.js
ts_lang_datadog_reporter/index.ts
ts_lang_datadog_reporter/logger.js
ts_lang_datadog_reporter/logger.ts
ts_lang_datadog_reporter/plugin.js
ts_lang_datadog_reporter/plugin.ts

🙁 Actual behavior

Following the example in the documentation but cannot load a plugin locally

🙂 Expected behavior

Documentation reflects reality

@RyanCavanaugh RyanCavanaugh self-assigned this Dec 14, 2021
@RyanCavanaugh
Copy link
Member

Documentation is out of date. The hosting process needs to pass an additional allowed plugin path; I'll add how to do this for VS Code

@RyanCavanaugh RyanCavanaugh added the Docs The issue relates to how you learn TypeScript label Dec 14, 2021
@orta
Copy link
Contributor

orta commented Jan 6, 2022

Thanks for the issue - the docs have been updated, and there's an example repo to work from at https://github.com/orta/TypeScript-TSServer-Plugin-Template too

@orta orta closed this as completed Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs The issue relates to how you learn TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants