0

I am writing a language server for my custom language. The way a source file is processed is partly influenced by a manifest.json file in the same directory as the source file. In a workspace there might be multiple directories with multiple source files and 1 manifest file per directory. example

DirA
    manifest.json
    sourcefile1.xyz
    sourcefile2.xyz
DirB
    DirB1
        manifest.json
        sf3.xyz
    DirB2
        manifest.json
        sf4.xyz

How can I make the manifest.json file available to the language server when the user is editing a .xyz file.

Corno
  • 5,448
  • 4
  • 25
  • 41

1 Answers1

0

the language server receives a TextDocument class which contains a uri. This uri has the 'file' protocol if it is stored on disk. with path.dirname(uri), you can get the directory of the file.

Corno
  • 5,448
  • 4
  • 25
  • 41