Closed markwpearce closed 4 years ago
No, there's not currently a way to hide xml errors with comments. However, if you wanted to just exclude that error for your entire project you can create a bsconfig.json
file at the root of your project.
{
"diagnosticFilters": [1004]
}
or you could focus those filters strictly on xml files like this:
{
"diagnosticFilters": [{
"src": "components/**/*xml",
"codes": [1004]
}]
}
However, most of the language features and syntax validation depends on being able to successfully find your files, so I would recommend trying to figure out why the language server cannot find those files before you just blanket exclude the errors. Take a look at the files
and rootDir
properties for the bsconfig.json
to see if perhaps it's just a simple config tweak. https://github.com/rokucommunity/roku-deploy#files-array
Thanks... the 1004 error comes up when we use uri syntax with "pkg:" like:
<script type="text/brightscript" uri="pkg:/source/utils.brs" />
our bsconfig.json looks like:
{
"rootDir": "./brands",
"files": [{
"src": "**/source/**/*.*",
"dest": "source"
},
{
"src": "**/components/**/*.*",
"dest": "components"
}
]
}
We have multiple roku apps under the brands folder (eg. brands/a, brands/b), with a "core" project in "brands/core". When we build a particular app, our custom build scripts basically copy "core" and overwrite it with stuff from a other brand folders.
The 1004 error problem comes in when we try to add files from another folder.
It's weird, because VSCode can find these files -- if I right-click on a script import like that and choose "go to definition" it opens the correct file.
Unfortunately, since your project is non-standard, you will need to do a little configuring to tell the language server how to understand your project. With respect to the extension, a workspace must represent a single roku project. You could create multiple vscode workspaces, one for each brand. or change the rootDir or files array based on which project you want to work on.
The good news is, your "core" build concept is fairly common in the Roku community and we already have full full support for that using the files array in the bsconfig.json as well as the launch.json for debugging. Here's an example of how to set it up for a single brand's project:
{
"rootDir": "mainApp",
"files": [
//include all of the files from "brands/a" (assuming "brands/a" is structured same as regular roku project)
{
"src": "brands/a/**/*",
//these files are relative to the root
"dest": ""
},
//override files from above with the app-specific files
"source/**/*",
"images/**/*",
"components/**/*",
"manifest"
]
}
Concerning the "Go to definition" functionality, we haven't ported that stuff over to the language server yet, so it's just falling back to scanning your whole workspace and running a bunch of regular expression matching.
If you really don't want to configure the language server, you can also just turn the language server off entirely in user/workspace settings by setting "brightscript.enableLanguageServer": false
.
If you have any more questions, feel free to reach out to us in the vscode-bs-lang-ext
channel in the Roku slack (https://join.slack.com/t/rokudevelopers/shared_invite/zt-4vw7rg6v-NH46oY7hTktpRIBM_zGvwA)
Cool -- we were able to fix it with the bsconfig.json. Now when working in the "core" project any other libraries are referenced as if they were in the same project, which is what we want.
{
"rootDir": "./brands",
"files": [{
"src": "**/source/**/*.*",
"dest": "./brands/core/source"
},
{
"src": "**/components/**/*.*",
"dest": "./brands/core/components"
}
]
}
Is there a way to disable an error/warning using the "bs:disable-next-line" syntax in XML files?
In our environment, we get the missing file error (1004) showing up in XML files.