secondlife / secondlife/sl-vscode-plugin
[1.0.4] Preprocessor Fails Unless Included Files Have Explicit `@line` Source Mapping
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:
#includetells the preprocessor which file to load and insert.// @lineprovides 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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