StarlaneStudios / vscode-comment-anchors

⚓A Visual Studio Code extension that adds support for comment anchors 🔭
https://marketplace.visualstudio.com/items?itemName=ExodiusStudios.comment-anchors
MIT License
208 stars 32 forks source link

Won't Work in Devcontainers #170

Open KerickHowlett opened 1 year ago

KerickHowlett commented 1 year ago

Won't Work in Devcontainers

Description

I've been working on a dotfiles automation project, and I've been leaving myself "@TODO" and "@NOTE" anchors all over my repo, but I only just now realized they weren't being highlighted. Even went to check the sidebar list and none of my comment anchors were registered there, either.

Since I've been working on a dotfiles automation project, I've been using (DevContainers)[https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers] to experiment and test my fish/shell scripts, so not to screw anything up in my current host computer's devenvironment.

A thing about devcontainers is that not all of your extensions will install in the remote dev environment unless you list your project's recommended/required extensions in the .devcontainer/devcontainer.json file's extensions array property. Though, your settings are carried over from your host VS Code's settings unless you wish to override them using either devcontainer/.devcontainer.json or .vscode/settings.json to override them (and I do so with the former). Knowing this, I re-opened my project using my host VS Code instance, and there it works fine. So for some unknown reason, I can't get it to work in conjunction with DevContainer.

Is there any chance I'm overlooking some essential config setting? Is this just a feature that hasn't been implemented? If so, are there plans to implement it? Or is this just a genuine bug?

Steps to Recreate Issue

Because I'm still experimenting with my dotfiles (and I'm somewhat a shy programmer), I have my project saved in a private repo until I'm ready to make it public. So I'll just write out the steps needed to recreate this issue:

  1. Install both (DevContainers)[https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers] and Comment Anchors extensions into VS Code.
  2. Create an empty temporary workspace.
  3. Create a directory called .devcontainer.
  4. Within the .devcontainer directory, create a Dockerfile containing the following code:
    ARG VARIANT="jammy"
    FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}
  5. Within the .devcontainer directory, create the devcontainer.json file containing the following code:
    {
    "$schema": "https://raw.githubusercontent.com/microsoft/vscode-css-languageservice/master/docs/customData.schema.json",
    "name": "Dotfiles Playground",
    "build": {
        "args": {
            "VARIANT": "jammy"
        },
        "dockerfile": "Dockerfile"
    },
    "extensions": [ "ExodiusStudios.comment-anchors" ],
    "remoteUser": "vscode",
    "settings": {
        "commentAnchors.tags.anchors": {
            "@ANCHOR": {
                "highlightColor": "#A8C023",
                "iconColor": "default",
                "scope": "file"
            },
            "@FIXME": {
                "highlightColor": "#F44336",
                "iconColor": "red",
                "scope": "workspace"
            },
            "@LINK": {
                "behavior": "link",
                "highlightColor": "#2ecc71",
                "iconColor": "#2ecc71",
                "scope": "workspace"
            },
            "@NOTE": {
                "highlightColor": "#FFB300",
                "iconColor": "orange",
                "scope": "file"
            },
            "@REVIEW": {
                "highlightColor": "#64DD17",
                "iconColor": "green",
                "scope": "workspace"
            },
            "@SECTION": {
                "behavior": "region",
                "highlightColor": "#896afc",
                "iconColor": "blurple",
                "scope": "workspace"
            },
            "@STUB": {
                "highlightColor": "#BA68C8",
                "iconColor": "purple",
                "scope": "file"
            },
            "@TODO": {
                "highlightColor": "#3ea8ff",
                "iconColor": "blue",
                "scope": "workspace"
            }
        },
        "commentAnchors.tags.separators": [
            " - ",
            ": ",
            " ",
            "# "
        ],
        "commentAnchors.tags.displayHierarchyInWorkspace": true,
        "commentAnchors.workspace.enabled": true,
            "workspaceFolder": "/home/vscode/workspace",
            "workspaceMount": "source=${localWorkspaceFolder},target=/home/vscode/.dotfiles,type=bind"
    }
  6. In the root of the workspace, create a file called test.fish -- though, any type of file will do, but this is what I'm primarily using in this project -- containing the following code:
    
    #!/usr/bin/env fish

@NOTE: The Comment Anchors extension won't work in DevContainers.

@TODO: Figure out why the Comment Anchors extension won't work in DevContainers.

@LINK: https://github.com/StarlaneStudios/vscode-comment-anchors/issues

echo "Comment Anchors extension won't work in DevContainers."

MatteCrystal commented 1 year ago

My technical understanding of what dev containers are and a majority of what you said is low to none. However, I think I'm having a similar issue and the reason is a lot less complex. (Then again maybe I'm completely wrong)

Anyway, I think it's just a matter of it doesn't work when used on files inside a folder that starts with a .

I for example am working on files in this path C:\Obsidian\Core\.obsidian and the extension doesn't seem to work for any files located in the .obsidian folder.

This is the path you are supposed to place your custom plugins and CSS for a notetaking app called obsidian. So I'm not personally doing anything with docker, dev containers, and all that.

KerickHowlett commented 1 year ago

Unfortunately, that doesn't help with my current issue, because the project directory I'm developing this in -- since its currently not in actual use yet -- isn't prefixed with a dot. Neither are any directory or folder within the project itself, nor are any of it's parent directories.