File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
language-server/src/features/codeAction Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 2
2
CodeActionKind ,
3
3
TextDocumentEdit
4
4
} from "vscode-languageserver" ;
5
+ import { getKeywordName } from "@hyperjump/json-schema/experimental" ;
5
6
import * as SchemaDocument from "../../model/schema-document.js" ;
6
7
import * as SchemaNode from "../../model/schema-node.js" ;
7
8
import * as jsoncParser from "jsonc-parser" ;
@@ -68,9 +69,10 @@ export class ExtractSubSchemaToDefs {
68
69
let newDefName = `def${ highestDefNumber + 1 } ` ;
69
70
const extractedDef = schemaDocument . textDocument . getText ( range ) ;
70
71
const newFormattedDef = formatNewDef ( extractedDef ) ;
71
- let defName = ( node . root . dialectUri === "https://json-schema.org/draft/2020-12/schema"
72
- || node . root . dialectUri === "https://json-schema.org/draft/2019-09/schema" )
73
- ? "$defs" : "definitions" ;
72
+ let defName = getKeywordName (
73
+ /** @type {string } */ ( node . root . dialectUri ) ,
74
+ "https://json-schema.org/keyword/definitions"
75
+ ) ;
74
76
75
77
/** @type {CodeAction } */
76
78
const codeAction = {
You can’t perform that action at this time.
0 commit comments