mirror of
https://github.com/Strum355/mcshader-lsp.git
synced 2025-08-31 13:57:27 +00:00
22 lines
No EOL
538 B
TypeScript
22 lines
No EOL
538 B
TypeScript
import * as fs from 'fs'
|
|
import * as vscode from 'vscode'
|
|
import GLSLProvider from './linter/glslProvider'
|
|
|
|
export class DescriptorHolder {
|
|
private holder: {[path: string]: number} = {}
|
|
|
|
public add(path: vscode.Uri) {
|
|
fs.open(GLSLProvider.getTempFilePath(path.path), 'r', (err, fd) => {
|
|
this.holder[path.path] = fd
|
|
})
|
|
}
|
|
|
|
public clear = () => {
|
|
for (const path in this.holder) {
|
|
if (this.holder.hasOwnProperty(path)) {
|
|
fs.close(this.holder[path])
|
|
delete this.holder[path]
|
|
}
|
|
}
|
|
}
|
|
} |