D
Deno

help

VS Code Extension API development with Deno as a runtime?

Bbzm3r1/27/2024
I'm dipping my toes into VS Code extension development. I only have Deno on my machine (for sanity), so the default template created by yo doesn't work out of the box. But I'd like to use it as a template to get going, and I'm wondering if I can have some help as I walk through this? Actually, is what I'm thinking of doing even possible/sensical? So here's the template generator: https://github.com/microsoft/vscode-generator-code/tree/main/generators/app I'm trying to figure out in particular where this node_modules directory is generated, which basically contains all the crap I would like to use through deno instead, i think but maybe that doesn't matter, because i can refer to a package inside there directly? so I tried that:
import * as vscode from "../../node_modules/@vscode";
import * as vscode from "../../node_modules/@vscode";
which results in the error:
Unable to load a local module: file:///home/bzm3r/personal/test-with-deno/node_modules/@vscode
Please check the file path. deno(no-local)
Unable to load a local module: file:///home/bzm3r/personal/test-with-deno/node_modules/@vscode
Please check the file path. deno(no-local)
So maybe tweaking the template itself is a bad idea, and I ought to be starting more "deno-native"? Actually, this might be relevant reading for me: https://docs.deno.com/runtime/manual/basics/import_maps okay, so running deno cache becomes relevant hmm, turns out yeoman just doesn't work under deno: https://github.com/denoland/deno/issues/19105 this is relevant: https://github.com/narumincho/vscode/tree/main
DAHDeno AI Helper1/27/2024
I wasn't able to find the answer to your question in the official Deno documentation. However, I can provide some general insights based on your message. Visual Studio Code extensions are typically developed using Node.js because the VS Code extension API is designed to work with Node.js runtime. Since Deno is not directly compatible with Node.js APIs and modules, using Deno as a runtime for VS Code extension development might not be straightforward. The default template created by yo (Yeoman) for VS Code extensions is set up with the expectation that Node.js is available. It likely includes dependencies and scripts that rely on Node.js-specific features and npm packages, which are not directly compatible with Deno. While it is theoretically possible to create a VS Code extension using Deno, it would require significant effort to adapt the extension API to work with Deno's runtime. This might involve creating or finding equivalent Deno modules for the Node.js modules used by the extension API, and ensuring that the extension's code is compatible with Deno's security model and module resolution. Please note that this advice is not based on the Deno documentation, and I would advise you to double-check the accuracy of the advice given. If you are committed to using Deno for this project, you may need to explore the Deno community for any existing efforts or tools that could help bridge the gap between Deno and the VS Code extension API. Otherwise, it might be more practical to use Node.js for VS Code extension development, as it is the supported runtime for that environment.
DAHDeno AI Helper1/27/2024
🦕💚 I'm glad I was able to help!
Bbzm3r1/27/2024
yeah bobot, a bit too late, but basically and surprisingly on point https://zenn-dev.translate.goog/narumincho/articles/deno-vscode-extension?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en-US&_x_tr_pto=wapp&_x_tr_hist=true TLDR: that person gives up near the end anyway, so yeah. just keep pnpm installed for now. can't go full deno

Looking for more? Join the community!

Recommended Posts
Importing submodulesHi, I am working for the first time with deno in my supabase edge functions. I am trying to import aVariable references causing lint errors across cells in Deno+JupyterIf you define a variable in one cell and then try to reference it in another cell, you get a "CannotVSCode starting Deno even if enabled=falseII use VSCode in a large project (with several JS packages, none of which use Deno), and after instalUnable to build crate with deno_runtime 0.139.0 or 0.140.0, due to version numbering in deno_astThe two most recently released versions of the deno_runtime crate cannot build at all, due to its buwalk() include only last directory...Hey, I'm currently trying to write a replacer for file names, file content and folder names. My goalHow to link local NPM package with DenoI have a package which has a couple of peer dependencies, which I want to link locally and patch. WhSubhosting API protectionIs there a way to setup custom auth via some header for example for all subhosting routes? I.e. Denolvim tsx language serverafter i clone fresh example in deno deploy, I get an error "Cannot find name 'React' " while openingHow to debug tests in Deno on VSCODEHello everyone, I am trying to debug a unit test in Deno. I have tried using deno test --inspect-brkDynamically importing NPM modules errorsThe following works fine in Node: ```js const parser = 'acorn'; const { parse } = await import(parsedeno kv watch vs broadcast channelFor creating a chat app for example, which one should i use? What are the differences? Kv watch geIf I use FFI with Deno Jupyter, will it not print the shared lib's stdout? (like Rust println!())If I use FFI with Deno Jupyter, will it not print the shared lib's stdout? This is an example of hStrange behavior of the assertRejects() method.Behavior of the `assertRejects()` method. `assertRejects()` fails when a non-stubbed method is callModule loadingHey, I am just testing the deno_core. I know, that the deno runtime with the command line supports Can I use deno_ast to transpile arbitrary typescript?I'm just wondering if it's safe to use deno_ast to transpile arbitrary (user-generated) typescript t`deno cache` with `node_modules_dir` moves sub-dependencies into `.deno/node_modules` dirIf I execute `deno cache --node-modules-dir package-lock.json`, a `node_modules` directory is createdeno options not available in vscode debugger optionslatest vscode, latest deno, yes ive got the extension installedCan I add properties to a websocket object?``` console.dir (socket.id) console.dir (socket) Object.assign (this.control.id, socket.id) ``` I aDeno + Vite + React + VSCodeCould someone help me setup VSCode so that it recognizes React JSX without red squiggles? Also, is Deno_bindgenI'm super happy to see the Deno NPM compatibility supporting an FFI call using Rust's NAPI crate for