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:
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:
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.
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
#includedirective alone resolves the file, but preprocessing does not complete correctly unless a corresponding// @linedirective is also present.For example, this alone does not work correctly:
Adding the explicit source mapping makes preprocessing work:
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
@linedirective, 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
@linemetadata, rather than a problem with include path resolution.Workspace structure
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:
It should automatically generate or preserve the required
@linesource 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.