redhat-developer / redhat-developer/vscode-java

Q: Is there a way from my project to programmatically detect that it is in vscode

Open
#1,155 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Gradle question
Dominant language
TypeScript
Stars
2.3k
Forks
546
Avg merge
20h 1m
Merged PRs (30d)
11

Description

I have a situation where a Gradle plugin I'm developing needs to take conditional actions depending on whether or not the project in which my Gradle plugin is applied, is currently being edited inside vscode.

I'm wondering if there might be someway for any random Java code that is part of a project, to programmatically detect that the project is currently opened in vscode.

Maybe something like querying the hierarchy of class loaders to see if some class that is only ever loaded by vscode-java is present? Or maybe there is something like a .lock file somewhere that would only exist if vscode-java is editing a specific project? Anything like that?

I realize I could have the code look in the root folder to see if a .vscode folder is there — or something along those lines. But I very often open projects in all of the different Java IDEs at different times. So although the project might be open in IntelliJ at any given time, it would be a false positive in the IntelliJ scenario when the detection code finds a .vscode folder from the previous times I might have edited the project in vscode.

Environment
  • Operating System: Windows/Linux/Mac OS
  • JDK version: Java 1.5 to Java 13+
  • Visual Studio Code version: 1.40.1 (system setup)
  • Java extension version: 0.53.1
  • Gradle 3.x - 6.x
Steps To Reproduce

Not Applicable

Current Result

Not Applicable

Expected Result

Not Applicable

Additional Informations

Not Applicable

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no repository files, tests, or implementation entry points; it asks whether Java code can detect that a project is open in VS Code. Start by reviewing the issue context and the repository's VS Code extension integration, then determine whether a scoped, testable change is defined. Done is not specified because the thread contains only a question.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, vscode
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.