Giter Site home page Giter Site logo

auto-import for `std` modules about vscode_deno HOT 4 OPEN

scarf005 avatar scarf005 commented on September 25, 2024
auto-import for `std` modules

from vscode_deno.

Comments (4)

nayeemrmn avatar nayeemrmn commented on September 25, 2024

@scarf005 It looked like #1069 was about exported symbols. Were you talking about files? This is already implemented: you need to add the following to your vscode settings:

{
  "deno.suggest.imports.hosts": {
    "https://deno.land": true
  }
}

jsr:@std/... supports this without configuration.

from vscode_deno.

scarf005 avatar scarf005 commented on September 25, 2024

It looked like #1069 was about exported symbols. Were you talking about files?

I was referring to symbols.

e.g I have to explicitly 'cache' https://deno.land/std/collections/map_values.ts to be able to import mapValues from there.

image

This is already implemented: you need to add the following to your vscode settings:

image

this doesn't work; i've already added the settings, yet in above screenshot it wouldn't suggest importing https://deno.land/std/collections/map_values.ts or https://deno.land/std/collections/mod.ts to be able to use mapValues.

from vscode_deno.

nayeemrmn avatar nayeemrmn commented on September 25, 2024

Okay I understand, the apiland link was a response to the last thing I said in #1069 (comment).

We can add a setting to preload select remote libs into the ts server so their auto-imports are always available. However, at this point we would only do that for jsr or npm specifiers. With these in Deno, it's no longer worth developing package sniffing infrastructure for arbitrary or favoured https URLs. e.g.:

{
  "deno.preloadPackages": [
    "jsr:@std/path", // Preload all exports in `jsr:@std/[email protected]`.
    "jsr:@std/fs/.", // Preload only the default export in `jsr:@std/[email protected]`.
    "jsr:@std/fs/expand-glob", // Preload only the `expand-glob` export in `jsr:@std/[email protected]`.
    "npm:preact" // Preload whatever paths and exports are included in the type declarations for `npm:[email protected]`.
  ]
}

from vscode_deno.

scarf005 avatar scarf005 commented on September 25, 2024

However, at this point we would only do that for jsr or npm specifiers. With these in Deno, it's no longer worth developing package sniffing infrastructure for arbitrary or favoured https URLs.

i disagree.

  1. jsr: or npm: specifiers cause vendor lock-in (namely, deno). only URLs are free of vendor lock-in.
  2. there's already existing package sniffing infrastructure (apiland), so it makes more sense to provide preloadPackages for http than jsr.

from vscode_deno.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.