@@ -7,6 +7,7 @@ import { Token, isFloatValue, isScalarValue } from "@sourcelib/kv";
77import { shaderParams , internalTextures } from "@sourcelib/vmt" ;
88import { KvSemanticProcessor , KvSemanticProcessorParams } from "./KvSemanticProcessor" ;
99import { KvPair } from "../Kv" ;
10+ import * as main from "../main" ;
1011import fs from "fs" ;
1112import path from "path" ;
1213
@@ -113,11 +114,14 @@ export class VmtSemanticTokenProvider extends KvTokensProviderBase {
113114 tokensBuilder . push ( range , "keyword" ) ;
114115 return ;
115116 }
116- const materialDir = getParentDocumentDirectory ( kvDoc . document . uri . fsPath , "materials" ) ;
117- if ( materialDir != null ) {
118- const materialPath : string = path . join ( materialDir , kv . value . content + ".vtf" ) ;
119- if ( ! fs . existsSync ( materialPath ) ) {
120- this . diagnostics . push ( new vscode . Diagnostic ( range , "Texture not found on disk" , vscode . DiagnosticSeverity . Warning ) ) ;
117+ const validationEnabled = main . config . get < boolean > ( "vmt.validateTexturePaths" ) ;
118+ if ( validationEnabled ) {
119+ const materialDir = getParentDocumentDirectory ( kvDoc . document . uri . fsPath , "materials" ) ;
120+ if ( materialDir != null ) {
121+ const materialPath : string = path . join ( materialDir , kv . value . content + ".vtf" ) ;
122+ if ( ! fs . existsSync ( materialPath ) ) {
123+ this . diagnostics . push ( new vscode . Diagnostic ( range , "Texture not found on disk" , vscode . DiagnosticSeverity . Warning ) ) ;
124+ }
121125 }
122126 }
123127
0 commit comments