Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto detection for custom languages #9

Open
alex-oser opened this issue Mar 21, 2022 · 4 comments
Open

Auto detection for custom languages #9

alex-oser opened this issue Mar 21, 2022 · 4 comments
Assignees
Labels
feature-request Request for new features or functionality
Milestone

Comments

@alex-oser
Copy link

I have an extension which provides some language support (folding and highlighting) for file trees. When opening an untitled file and pasting in a tree, the extension will try to set the language to tree if it has some specific characters (ex. ├──, └──). However, once language detection kicks in it automatically changes it to ini.

I was testing the language detection code and can clearly see that for a tree file it somehow detects ini with 100% confidence. So there are 2 questions:

  1. Is it a bug that this is being detected as an ini file?
  2. Is there any process for hooking into/add languages to the custom detection API?

I tested the language detection code with the below

const vsl = require("@vscode/vscode-languagedetection");
const modulOperations = new vsl.ModelOperations();
(async () => {
    const result = await modulOperations.runModel(`
    ├── functions
    ├── src
    │    ├── articles
    │    ├── components
    │    ├── constants
    │    ├── contexts
    │    ├── data
    │    ├── hooks
    │    ├── i18n
    │    │    └── locales
    │    ├── modals
    │    │    └── sections
    │    ├── pages
    │    │    ├── app
    │    │    └── r
    │    ├── styles
    │    ├── templates
    │    └── utils
    └── static
        └── images
            ├── screenshots
            └── templates
    `);
    console.log(result);
})();

Output:

image

@Hacksore
Copy link

linking the issue we have open in vscode-tree-language for more context.

structure-codes/vscode-tree-language#13

@isidorn
Copy link

isidorn commented May 3, 2022

fyi @TylerLeonhardt

@zm-cttae
Copy link

zm-cttae commented Dec 5, 2022

Filling the information gap here - the neural net model is yoeo/guesslang, which doesn't support tree.

@Hacksore
Copy link

Looks like there are talks about changing the model for detection here microsoft/vscode#143910

@TylerLeonhardt TylerLeonhardt self-assigned this Dec 13, 2022
@TylerLeonhardt TylerLeonhardt added the feature-request Request for new features or functionality label Dec 13, 2022
@TylerLeonhardt TylerLeonhardt added this to the Backlog milestone Dec 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

5 participants