You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently all logic relating to filesystem works with OS-specific path separators - i.e. in practice \ on Windows and / everywhere else. In order for us to fully utilise io/fs package and its functions, we need to align our separators with the expectations of that package.
This means using / (forward slashes) exclusively (even on Windows) as path separators. This also makes it more straight-forward to test any FS-dependent logic using testing/fstest which also makes the same assumptions about path separator being /.
Note that paths are slash-separated on all systems, even Windows. Paths containing other characters such as backslash and colon are accepted as valid, but those characters must never be interpreted by an FS implementation as path element separators.
Proposal
Use universal /-separated paths in the following packages (which currently import path/filepath):
internal/filesystem
internal/pathcmp
internal/terraform/datadir
internal/uri
internal/document
internal/lsp
internal/terraform/parser
internal/logging
internal/langserver/diagnostics
internal/langserver/handlers (initialize + workspace/didChangeWatchedFiles handlers + test files)
internal/walker
Update internal/state to accept document.DirHandle instead of paths
The text was updated successfully, but these errors were encountered:
Background
Currently all logic relating to filesystem works with OS-specific path separators - i.e. in practice
\
on Windows and/
everywhere else. In order for us to fully utiliseio/fs
package and its functions, we need to align our separators with the expectations of that package.This means using
/
(forward slashes) exclusively (even on Windows) as path separators. This also makes it more straight-forward to test any FS-dependent logic usingtesting/fstest
which also makes the same assumptions about path separator being/
.https://pkg.go.dev/io/fs#ValidPath
Proposal
/
-separated paths in the following packages (which currently importpath/filepath
):internal/filesystem
internal/pathcmp
internal/terraform/datadir
internal/uri
internal/document
internal/lsp
internal/terraform/parser
internal/logging
internal/langserver/diagnostics
internal/langserver/handlers
(initialize
+workspace/didChangeWatchedFiles
handlers + test files)internal/walker
internal/state
to acceptdocument.DirHandle
instead of pathsThe text was updated successfully, but these errors were encountered: