Comments (2)
I believe this contains how it was done previously: https://github.com/pengx17/json-schema/blob/master/main.jsx
The current version of Monico Editor appears to have removed the quickOpen however.
Let me know if you have any success.
from monaco-yaml.
Sorry, if it's the wrong place to ask
Technically yes, but I think breadcrumbs are a nice way to show the features provided by monaco-yaml
. You can see how I implemented breadcrumbs in https://github.com/remcohaszing/monaco-yaml/pull/94/files
It basically comes down to:
import { editor, languages, Position, Range } from 'monaco-editor';
import { CancellationToken } from 'monaco-editor/esm/vs/base/common/cancellation';
import { getDocumentSymbols } from 'monaco-editor/esm/vs/editor/contrib/documentSymbols/documentSymbols';
function* iterateSymbols(
symbols: languages.DocumentSymbol[],
position: Position,
): Iterable<languages.DocumentSymbol> {
for (const symbol of symbols) {
if (Range.containsPosition(symbol.range, position)) {
yield symbol;
yield* iterateSymbols(symbol.children, position);
}
}
}
const ed = editor.create(document.getElementById('editor'), {
value: '',
language: 'yaml',
});
ed.onDidChangeCursorPosition(async (event) => {
const symbols = await getDocumentSymbols(ed.getModel(), false, CancellationToken.None);
// Do whatever you want with the symbols here. :)
});
This uses some undocumented, untyped monaco-editor
APIs, so it may break with newer releases of monaco-editor
. Providing the document symbols based on YAML content is a feature of monaco-yaml
and will continue to work.
from monaco-yaml.
Related Issues (20)
- how to use `yaml` as an embedded language HOT 4
- Autompletion not working in Example HOT 2
- support prettier v3 HOT 2
- configureyaml is not working with @monaco-editor/react HOT 12
- References fail to resolve when using locally defined schema with `enableSchemaRequest` set to false HOT 1
- Ability to tweak autocompletion HOT 1
- monaco-yaml在销毁的时候调用dispose()后控制台报错 HOT 1
- [ BUG ] Next.JS 14.1 Can't load worker file HOT 1
- [ NEED HELP ] window is not defined on NextJS 14.1.0 HOT 3
- How to load with @monaco-editor/loader? HOT 1
- Does this library is support with monaco editor AMD version HOT 4
- Enum autocomplete didn't put string inside quote HOT 1
- Uncaught (in promise) Error: Worker manager has been disposed HOT 3
- The error message for the enumeration type is incorrect HOT 2
- Error since 5.2.0 / "export 'toSelectionRanges' (imported as 'toSelectionRanges') was not found in 'monaco-languageserver-types'" HOT 2
- Yaml worker can't read properties of undefined HOT 4
- Missing this package “monaco-marker-data-provider” HOT 8
- Is it possible to detect multiple schemas in one editor? HOT 1
- toSelectionRanges was not found in 'monaco-languageserver-types' HOT 1
- Error `toSelectionRanges` is not exported HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from monaco-yaml.