Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

[Feature Request] Support URLs as model URI (for URL imports) #3248

Closed
2 tasks done
tzvc opened this issue Aug 15, 2022 · 0 comments
Closed
2 tasks done

[Feature Request] Support URLs as model URI (for URL imports) #3248

tzvc opened this issue Aug 15, 2022 · 0 comments
Labels
feature-request Request for new features or functionality

Comments

@tzvc
Copy link

tzvc commented Aug 15, 2022

Context

  • This issue is not a bug report. (please use a different template for reporting a bug)
  • This issue is not a duplicate of an existing issue. (please use the search to find existing issues)

Description

Hi there,

I'm building a web IDE for Deno which supports URL imports:

// valid in deno
import { serve } from "https://deno.land/[email protected]/http/server.ts";
// serve is fully typed here

This is not yet supported by Typescript so I have to make a custom logic into monaco.

My first thought was: When I detect a URL import in the code, fetch the URL and compile all the sources into one big .d.ts file. Then, load that file into the editor with .addExtraLib specifying the URL as the filepath.

const source = await fetch(URLImport).then((r) => r.text());
monaco.languages.typescript.javascriptDefaults.addExtraLib(source, URLImport);
monaco.editor.createModel(source, 'typescript', monaco.Uri.parse(URLImport));

I thought this would be enough for monaco to "link" the import URL with the type definition now loaded locally at that address, but it appears not.

What am I missing here? If this is not possible this way, what could I try to support URL imports in TS in monaco?

Cheers!

@tzvc tzvc added the feature-request Request for new features or functionality label Aug 15, 2022
@microsoft microsoft locked and limited conversation to collaborators Mar 13, 2023
@hediet hediet converted this issue into discussion #3811 Mar 13, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

1 participant