papyrus-lang icon indicating copy to clipboard operation
papyrus-lang copied to clipboard

language client/server doesn't reload PPJ files on change

Open rjstone opened this issue 4 years ago • 3 comments

Describe the bug

Actually this is only a problem if the .PPJ file is in the workspace root (separate folder, not in the game directory) and possibly only for skyrimse.

I'm unsure if this is a bug or an enhancement request but... there's some code here in LanguageClient.ts:

        this._fsWatcher = workspace.createFileSystemWatcher('**/*.{flg,ppj,psc}');
        this._client = new BaseClient(
            options.game.toString(),
            {
                command: options.toolPath,
                args: toCommandLineArgs(options.toolArguments),
            },
            {
                outputChannel: options.outputChannel,
                documentSelector: [
                    { scheme: 'file', language: 'papyrus' },
                    { scheme: 'file', language: 'papyrus-project' },
                ],
                synchronize: {
                    fileEvents: this._fsWatcher,
                    configurationSection: 'papyrus',
                },
            }
        );

That makes it look like the intention is to watch for changes in .PPJ files but the language server doesn't reload those files when they are edited and saved.

To Reproduce Steps to reproduce the behavior:

  1. Open a workspace with a PPJ file.
  2. Change/add/delete an import or source path.
  3. Changes don't take effect in the project explorer. You have to close and reopen the workspace to get them picked up.

rjstone avatar Oct 14 '19 13:10 rjstone

It's possible this should just be "wontfix" because I'm not sure it makes sense to support PPJ files for skyrimse anyway. Nothing else for skyrim/se uses them, and if these things are just stored in the .code-workspace config they can be easily inserted into build task configs in tasks.json. That would make project generation easier too.

Basically I'm suggesting just adding Source Folder and Import Folder (As ; delimited list) to the config since you have to pass these to sse papyruscompiler anyway. FO4 could potentially use either option (I'm not sure it hurts to allow this to be used for FO4 too) but FO4 uses probably want to just use the PPJ since that's the FO4 way of doing things and the compiler will actually read that.

rjstone avatar Oct 14 '19 13:10 rjstone

@rjstone Changing a PPJ should still cause projects to reload, IMO.

joelday avatar Oct 14 '19 16:10 joelday

https://github.com/joelday/papyrus-lang/blob/master/src/DarkId.Papyrus.Server/WorkspaceManager.cs#L107 Isn't handling change events. There currently isn't a way to tell a specific associated project instance to reset itself. I think it would be reasonable to reset all projects when one project changes, though.

joelday avatar Oct 14 '19 16:10 joelday