secondlife / secondlife/sl-vscode-plugin

[1.0.4] Preprocessor Fails Unless Included Files Have Explicit `@line` Source Mapping

Open
#79 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
33
Forks
15
Avg merge
14h 50m
Merged PRs (30d)
9

Description

The issue does not appear to be caused by include path resolution itself. The included files are correctly located through slVscodeEdit.preprocessor.includePaths.

However, the preprocessor appears to lose, or fail to initialize, the source mapping information for included files. As a result, the #include directive alone resolves the file, but preprocessing does not complete correctly unless a corresponding // @line directive is also present.

For example, this alone does not work correctly:

#include "DM_Common.lsl"

Adding the explicit source mapping makes preprocessing work:

#include "DM_Common.lsl"
// @line 1 "workspace:///Archivist/include/DM_Common.lsl"

The two directives serve different purposes:

  • #include tells the preprocessor which file to load and insert.
  • // @line provides the source URI and line-number mapping for the included file.

The observed behavior suggests a bug in the handling of source metadata for files included from a workspace subdirectory. Without the @line directive, the file is found, but its source context does not appear to be registered correctly. Adding the directive manually allows preprocessing to continue normally.

This therefore appears to be an issue with the automatic generation or propagation of @line metadata, rather than a problem with include path resolution.

Workspace structure

Archivist/
├── include/
│   ├── DM_Common.lsl
│   ├── DM_Release.lsl
│   ├── DM_StartupProtocol.lsl
│   └── DM_UpdateProtocol.lsl
├── lsl/
├── doc/
├── nc/
└── Archivist.code-workspace

Workspace configuration

{
    "folders": [
        {
            "path": "."
        }
    ],
    "settings": {
        "slVscodeEdit.enabled": true,
        "slVscodeEdit.network.websocketPort": 9020,
        "slVscodeEdit.preprocessor.enable": true,
        "slVscodeEdit.preprocessor.includePaths": [
            ".",
            "./include/",
            "./lib",
            "**/include/"
        ],
        "slVscodeEdit.preprocessor.maxIncludeDepth": 10,
        "slVscodeEdit.preprocessor.lsl.switchStatements": true,
        "slVscodeEdit.sync.keepViewerFileOpen": true,
        "slVscodeEdit.sync.askIfViewerScriptMismatchesMaster": true,
        "slVscodeEdit.sync.includeFileMetaInOutput": true
    }
}

Expected behavior

The preprocessor should resolve and process the include correctly using only:

#include "DM_Common.lsl"

It should automatically generate or preserve the required @line source mapping metadata.

Actual behavior

The include file is found, but preprocessing only succeeds after manually adding:

// @line 1 "workspace:///Archivist/include/DM_Common.lsl"

Thanks.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the preprocessor failure with the workspace configuration and an include such as DM_Common.lsl, then trace how included files receive source mapping metadata. Confirm that #include alone completes preprocessing and automatically generates or preserves the expected @line mapping without requiring a manually added directive.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.