mihai-vlc / path-autocomplete

Path autocomplete for visual studio code.

Home Page:https://marketplace.visualstudio.com/items?itemName=ionutvmi.path-autocomplete

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

support trim specific extension on import

tjx666 opened this issue · comments

In normal web project, when import js/ts/jsx/tsx/mts/mjs/cjs they needn't complete extension. But like less/scss/png etc need.

So, it would be better to have a configuration to configure to make only trim specific extension on import.

@mihai-vlc

@mihai-vlc My use case is that in my project, vscode builtin typescript relative path module suggestion doesn't work. So I want to use this extension to support path suggestion.
But you can see this extension provide suggestion with file extension:

image

For now, we have setting path-autocomplete.extensionOnImport, but that can't solve my need.

I want to trim file extension for ts/js, but not for css/scss/less etc

Hi @tjx666 ,

Can you try configuring the language specific settings in v1.23 ?

    "path-autocomplete.extensionOnImport": true,
    "[typescript]": {
        "path-autocomplete.extensionOnImport": false,
    },

Please feel free to reopen the ticket if you still encounter issues.

You may also want to combine this with path-autocomplete.transformations if you want to remove the extension for certain completion items but keep it for others.

I need use autocomplete.transformations setting to restore scss/less which is a little complex.

My thought is to let path-autocomplete.extensionOnImport setting support object value. like:

{
    "path-autocomplete.extensionOnImport": {
        "*.{ts,tsx,js,jsx}": false
    }
}

would something like this work ?

"path-autocomplete.extensionOnImport": true,
    "path-autocomplete.transformations": [
        {
            "type": "replace",
            "parameters": [
                "\\.\\w+$",
                ""
            ],
            "when": {
                "fileName": "\\.(ts|tsx|js|jsx)$"
            }
        }
    ],

would something like this work ?

Nice work.