Skip to content

Commit 829e27c

Browse files
committed
fix: Fix code with new rules
1 parent 972c7b4 commit 829e27c

File tree

6 files changed

+24
-24
lines changed

6 files changed

+24
-24
lines changed

src/extensions/cobol.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as monaco from 'monaco-editor'
22

33
const fixedPositions = [0, 6, 7, 11]
4-
const lastFixedPosition = fixedPositions[fixedPositions.length - 1]
4+
const lastFixedPosition = fixedPositions[fixedPositions.length - 1]!
55

66
function getIndentWidth (editor: monaco.editor.IStandaloneCodeEditor): number {
77
return editor.getModel()!.getOptions().tabSize

src/features/jsonContribution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const registry = monaco.extra.Registry.as<monaco.extra.IJSONContributionRegistry
77
// Hack because the commands are filled by a code not run in monaco-editor
88
{
99
const allCommands = monaco.extra.CommandsRegistry.getCommands()
10-
const keybindingsCommandSchema = (registry.getSchemaContributions().schemas['vscode://schemas/keybindings']!.items as monaco.extra.IJSONSchema).properties!.command.anyOf![0]!
10+
const keybindingsCommandSchema = (registry.getSchemaContributions().schemas['vscode://schemas/keybindings']!.items as monaco.extra.IJSONSchema).properties!.command!.anyOf![0]!
1111
keybindingsCommandSchema.enum = Array.from(allCommands.keys())
1212
keybindingsCommandSchema.enumDescriptions = <string[]>Array.from(allCommands.values()).map(command => command.description?.description)
1313
}

src/languages/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ function parseLanguageConfiguration (config: RawLanguageConfiguration): monaco.e
7373
...config,
7474
folding: config.folding != null
7575
? {
76-
...config.folding,
77-
markers: (markers != null) ? { start: new RegExp(markers.start), end: new RegExp(markers.end) } : undefined
78-
}
76+
...config.folding,
77+
markers: (markers != null) ? { start: new RegExp(markers.start), end: new RegExp(markers.end) } : undefined
78+
}
7979
: undefined
8080
}
8181
}

src/languages/textMate/semanticTokens.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ for (const contribution of extensions.semanticTokenModifiers as ITokenModifierEx
2929

3030
for (const contribution of extensions.semanticTokenScopes as unknown as ITokenStyleDefaultExtensionPoint[]) {
3131
for (const selectorString in contribution.scopes) {
32-
const tmScopes = contribution.scopes[selectorString]
32+
const tmScopes = contribution.scopes[selectorString]!
3333
const selector = tokenClassificationRegistry.parseTokenSelector(selectorString, contribution.language)
3434
tokenClassificationRegistry.registerTokenStyleDefault(selector, { scopesToProbe: tmScopes.map(s => s.split(' ')) })
3535
}

src/tools.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -159,22 +159,22 @@ export function hideCodeWithoutDecoration (editor: monaco.editor.IStandaloneCode
159159
.sort((a, b) => a.startLineNumber - b.startLineNumber)
160160
// merge ranges
161161
.reduce<monaco.Range[]>((acc, range) => {
162-
if (acc.length === 0) {
163-
return [range]
164-
}
165-
const lastRange = acc[acc.length - 1]
166-
if (range.getStartPosition().isBeforeOrEqual(lastRange.getEndPosition())) {
167-
return [
168-
...acc.slice(0, -1),
169-
monaco.Range.fromPositions(lastRange.getStartPosition(), range.getEndPosition())
170-
]
171-
} else {
172-
return [
173-
...acc,
174-
range
175-
]
176-
}
177-
}, [])
162+
if (acc.length === 0) {
163+
return [range]
164+
}
165+
const lastRange = acc[acc.length - 1]!
166+
if (range.getStartPosition().isBeforeOrEqual(lastRange.getEndPosition())) {
167+
return [
168+
...acc.slice(0, -1),
169+
monaco.Range.fromPositions(lastRange.getStartPosition(), range.getEndPosition())
170+
]
171+
} else {
172+
return [
173+
...acc,
174+
range
175+
]
176+
}
177+
}, [])
178178

179179
let hiddenAreas: monaco.IRange[] = [...otherHiddenAreas]
180180
let position = new monaco.Position(1, 1)

update-extensions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ async function createRepositoryFileResolver (extension: Extension) {
369369
const from = parsed[key].path
370370
const githubOrigin = /https:\/\/github\.com\/(.*)/.exec(parsed[key].url)
371371
if (githubOrigin != null) {
372-
map[from] = githubOrigin[1]
372+
map[from] = githubOrigin[1]!
373373
}
374374
}
375375
}
@@ -382,7 +382,7 @@ async function createRepositoryFileResolver (extension: Extension) {
382382
let rpath = `${extension.path ?? ''}${fixedPath}`
383383
let version = extension.version ?? 'master'
384384
for (const from in map) {
385-
const to = map[from]
385+
const to = map[from]!
386386
if (rpath.startsWith(from)) {
387387
repository = to
388388
rpath = path.relative(from, rpath)

0 commit comments

Comments
 (0)