Skip to content

Improper handling of file paths when creating a file-local document in the workspace #3667

@thakyZ

Description

@thakyZ

Authors Note

So that I do not have to repeat myself too much when referring to the term "workspace" it also refers to #the current working directory from where harper-ls or harper-cli was called.

The root of the path refers to #:\ on Windows or if applicable / on Unix.
I have not tested this issue on a Linux machine yet.

Describe the bug

A clear and concise description of what the bug is.

When the configuration for harper-ls points the file-local dictionary path or ignore file to a sub-directory inside the workspace.

And when creating a file-local dictionary or harper ignore file the created file is created in the same directory that would be referred to as the workspace.

The file-local dictionary or ignore file is created with the full path except for the root of the path and each directory separator character is changed to be a % character.

Which is not respecting any of the previously specified configuration options.

The full path should not be used if the file-local dictionary path or ignore file path is in the current workspace as the absolute path varies from environment to environment.

To Reproduce

Steps to reproduce the behavior:

  1. Go to a file with a harper-ls "problem".
  2. Right-click the underlined area and click "Ignore harper issue" or "Add to file-local dictionary"
  3. Note the newly created file in the workspace despite the configuration setting.

Expected behavior

A clear and concise description of what you expected to happen.

The configuration for file-local dictionaries and ignore files should be respected from the workspace.

As well as the file-local dictionaries and ignore files should not contain the full path, but preferably the path from the current workspace.

Screenshots

If applicable, add screenshots to help explain your problem.

Code Block in ./.vscode/settings.json

{
  /*...*/
  "harper.workspaceDictPath": "./dictionaries/workspace/workspace.dic",
  "harper.fileDictPath": "./dictionaries/files",
  "harper.ignoredLintsPath": "./dictionaries/ignores",
  /*...*/
}
A screenshot from Visual Studio Code showing a newly created harper ignore file for a local file which is in the workspace root despite the configuration in the above code block.
A screenshot from Visual Studio Code showing a newly created harper ignore file for a local file which is in the workspace root despite the configuration in the above code block.

Platform

What platform has the issue? Is it in Obsidian, Chrome or Firefox, Visual Studio Code, the Desktop app, Neovim, or something else?

Tested with Visual Studio Code and a plugin called LSP4J in JetBrains' IDEs. Which the latter just uses harper-ls via calling it, so it's more than likely an issue with the language server and not any specific IDE.

Additional context

Add any other context about the problem here.

I am using Windows, I haven't tried it with a Unix machine (Linux or MacOS) so I am not 100% sure if it affects any of those.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions