Skip to content

Commit

Permalink
Remove dependency to fix browser compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
siliconspecter committed Jul 7, 2024
1 parent 41bac08 commit 9c67503
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 32 deletions.
18 changes: 12 additions & 6 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,18 @@ import type {
Definition,
DefinitionLink,
Diagnostic,
TextEditor
TextEditor,
TextDocumentChangeEvent
} from 'vscode'
import { optionalRequire } from 'optional-require'

// eslint-disable-next-line @typescript-eslint/no-var-requires
const vscode = optionalRequire('vscode')
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
let vscode: typeof import('vscode')

try {
// eslint-disable-next-line @typescript-eslint/no-var-requires
vscode = require('vscode')
} catch (e) {
}

const documentSelector: DocumentSelector = {
scheme: 'file',
Expand Down Expand Up @@ -515,8 +521,8 @@ export function activate (context: ExtensionContext): void {
definitionProvider
),
diagnosticCollection,
vscode.workspace.onDidChangeTextDocument((textEditor: TextEditor) => {
refreshDiagnostics(textEditor.document)
vscode.workspace.onDidChangeTextDocument((e: TextDocumentChangeEvent) => {
refreshDiagnostics(e.document)
}),
vscode.workspace.onDidCloseTextDocument((document: TextDocument) => {
diagnosticCollection.delete(document.uri)
Expand Down
38 changes: 16 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@
},
"publisher": "skitscript",
"devDependencies": {
"@skitscript/parser-nodejs": "2.0.2",
"@types/jasmine": "^4.6.4",
"@types/node": "^20.14.10",
"@types/rewire": "^2.5.30",
"@types/vscode": "^1.90.0",
"@typescript-eslint/eslint-plugin": "^5.59.1",
Expand All @@ -62,10 +64,8 @@
"npm-run-all": "^4.1.5",
"rewire": "^7.0.0",
"typescript": "^5.4.5",
"vscode-tmgrammar-test": "^0.1.3",
"@skitscript/parser-nodejs": "2.0.2",
"optional-require": "^1.1.8",
"vsce": "^2.15.0"
"vsce": "^2.15.0",
"vscode-tmgrammar-test": "^0.1.3"
},
"scripts": {
"test": "npm-run-all testCleanCases testCopyCases testSnapshot buildCleanTypeScript buildLintFix buildTypeScript buildEsbuild buildJasmine",
Expand Down

0 comments on commit 9c67503

Please sign in to comment.