{"id":15890562,"url":"https://github.com/dimfeld/codemirror-json5","last_synced_at":"2025-03-20T11:36:14.622Z","repository":{"id":64644398,"uuid":"576736809","full_name":"dimfeld/codemirror-json5","owner":"dimfeld","description":"Codemirror 6 support for JSON5","archived":false,"fork":false,"pushed_at":"2023-09-21T21:21:25.000Z","size":20,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-07T07:06:39.998Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dimfeld.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-10T20:15:02.000Z","updated_at":"2024-05-06T19:44:51.000Z","dependencies_parsed_at":"2024-06-20T19:06:27.680Z","dependency_job_id":null,"html_url":"https://github.com/dimfeld/codemirror-json5","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimfeld%2Fcodemirror-json5","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimfeld%2Fcodemirror-json5/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimfeld%2Fcodemirror-json5/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimfeld%2Fcodemirror-json5/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dimfeld","download_url":"https://codeload.github.com/dimfeld/codemirror-json5/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221753100,"owners_count":16875084,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-06T07:06:46.382Z","updated_at":"2024-10-28T00:41:38.392Z","avatar_url":"https://github.com/dimfeld.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# codemirror-json5\n\nThis package implements JSON5 support for Codemirror 6.\n\nBeyond the basic support, it provides a linter and state fields that expose:\n\n- The parsed object produced by the JSON5 parser, so that your surrounding code can use that result instead of parsing it twice.\n- The path in the object that the cursor is on.\n\n## Usage\n\n```javascript\nimport { json5, json5ParseLinter } from 'codemirror-json5';\nimport { linter } from '@codemirror/lint';\nimport { EditorState } from '@codemirror/state';\nimport { EditorView } from '@codemirror/view';\n\nconst view = new EditorView({\n  state: EditorState.create({\n    doc: `{ a_doc: 'goes here' }`,\n    extensions: [\n      json5(),\n      linter(json5ParseLinter()),\n    ]\n  })\n});\n```\n\n## Retrieving Editor State\n\n```typescript\nimport { EditorState } from '@codemirror/state';\nimport { jsonCursorPath, json5ParseCache } from 'codemirror-json5';\nimport get from 'just-safe-get';\n\nfunction getJson5Info(state: EditorState) {\n  const object = state.field(json5ParseCache);\n  const { path } = state.field(jsonCursorPath);\n\n  return {\n    parsed: object.obj,\n    parseError: object.err,\n    cursorPath: path,\n    cursorValue: get(object.obj ?? {}, path),\n  };\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimfeld%2Fcodemirror-json5","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdimfeld%2Fcodemirror-json5","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimfeld%2Fcodemirror-json5/lists"}