Danielduel8mo ago

Recommended `denoland/deno` contributor editor setup

I have a problem with deno trying to redefine itself via random declare namespace Deno { ... } throughout the deno repo. I use vscodium with TypeScript 5.2.2, latest Deno. I fail to find any docs on how you recommend to setup the editor to make lsp correctly pick up things.
4 Replies
Deno AI Helper
Deno AI Helper8mo ago
For contributing to the denoland/deno repository, it's important to have an editor setup that works well with the Deno codebase. The documentation provides detailed instructions for setting up Visual Studio Code, which can be applied to VSCodium as well, since they share the same extension ecosystem. Here's a general guide based on the documentation for setting up your editor with the Deno extension: 1. Install the Deno Extension: Make sure you have the official Deno extension installed in VSCodium. This extension integrates directly with the Deno CLI using the Language Server Protocol, ensuring that the information you get about your code aligns with how that code will work when you run it under the Deno CLI. 2. Enable Deno in Your Workspace: Not every project you edit with VSCodium is a Deno project. To enable Deno for a specific workspace, you can use the Deno: Initialize Workspace Configuration command from the command palette. This will set up the necessary settings in your workspace's .vscode/settings.json file. 3. Configure the Deno Extension: There are various settings available to configure the Deno extension to work best for your needs. You can enable or disable linting, unstable APIs, and set a specific path to the Deno CLI if it's not in your system's PATH. 4. Use a Configuration File: While typically not required, a deno.json or deno.jsonc configuration file can be useful in some scenarios. The Deno extension will automatically identify and apply settings from these files if they are present in the workspace root. 5. Formatting: The Deno CLI comes with a built-in formatter (deno fmt), which can be configured to be used by VSCodium. You can set Deno as the default formatter for TypeScript and JavaScript files. 6.
Deno AI Helper
Deno AI Helper8mo ago
Import Suggestions: The Deno extension will offer suggestions to complete imports, including local files and cached remote files. If you're encountering issues with declare namespace Deno { ... } redefinitions, it could be related to how TypeScript is resolving type definitions within the Deno codebase. Make sure that the Deno extension is properly enabled and configured for your workspace, as this should help the LSP correctly pick up the Deno namespaces and types. For more specific issues, you might need to look into the TypeScript configuration and ensure that it's not conflicting with Deno's types. If the problem persists, consider reaching out to the Deno community or checking the GitHub issues for similar problems encountered by other contributors. 🦕
dmio_co8mo ago
All you should need is that plugin: https://marketplace.visualstudio.com/items?itemName=denoland.vscode-deno (official). You don't need any tsconfig file etc. What you'd need however is in your .vscode/settings.json, 2 keys: deno.enable: true and deno.enablePaths: ["."] (feel free to amend paths if needed)
Deno - Visual Studio Marketplace
Extension for Visual Studio Code - A language server client for Deno.
NDH8mo ago
You must also, at least once, run the config command:
Deno: Initialize Workspace Configuration
Deno: Initialize Workspace Configuration
from the VS Code command palette.