Skip to content

Relative paths are relative to the configuration file and not the caller. #762

@pcastellazzi

Description

@pcastellazzi

This is probably intended but i would like to know if there is a workaround.

I would like my configuration in a central location that can be shared between the command line interface and the visual studio code extension. Using the example for the documentation i set it up as follows:

# ~/.config/cspell/cspell.yaml
---
$schema: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json
version: '0.2'
dictionaryDefinitions:
    - name: project-words
      path: 'project-words.txt'
      addWords: true
dictionaries:
    - project-words

And try to use it from the command line as follows:

mkdir -p ~/example-project
cd ~/example-project
echo "Hello Mundo" > example.md
echo "Mundo" >project-words.txt
env CSPELL_DEFAULT_CONFIG="~/.config/cspell/cspell.yaml" cspell *.md

I got the following error:

Errors:
Dictionary Error with (project-words) Error: ENOENT: no such file or directory, open '~/.config/cspell/project-words.txt'

I would expect relative paths to be relative to the current working directory, not the configuration file, or at least a way to specify which one i want, like vscode ${workspace} or ${env:PWD}.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions