Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing XAML editor to use Monaco editor #140

Merged
merged 4 commits into from
Nov 12, 2020

Conversation

nickrandolph
Copy link
Contributor

GitHub Issue (If applicable): #139

PR Type

What kind of change does this PR introduce?

  • Feature

What is the current behavior?

XAML editor is simple textbox

What is the new behavior?

XAML editor uses the Monaco editor which can provide intellisense and code highlighting

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tested code with current supported SDKs
  • Docs have been added/updated which fit documentation template. (for bug fixes / features)
  • Unit Tests and/or UI Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Wasm UI Tests are not showing unexpected any differences. Validate PR Screenshots Compare Test Run results.
  • Contains NO breaking changes
  • Updated the Release Notes
  • Associated with an issue (GitHub or internal)

Other information

Internal Issue (If applicable):

@CLAassistant
Copy link

CLAassistant commented Jul 6, 2020

CLA assistant check
All committers have signed the CLA.

@nickrandolph
Copy link
Contributor Author

nickrandolph commented Jul 6, 2020

@carldebilly let me know what you think. I think before this PR is merged, it would be good to work out how the monaco editor files could be included in the MonacoEditorComponet, rather than explicitly added as source code.

Adding Uno.Monaco.Editor nuget package
@nickrandolph
Copy link
Contributor Author

@carldebilly I've fixed up the Uno.Monaco.Editor nuget package so we don't need to include all the monaco source files here (or anywhere else that wants to use the Monaco Editor)

Intellisense - I've only added TextBlock but we can easily add any of the XAML elements
Error highlighting works - Only issue is that the XAML parser doesn't seem to be that accurate with where the errors actually are, so perhaps a bit of refinement to be done but at least the user sees the marking in the right spot
@nickrandolph
Copy link
Contributor Author

GifMaker_20200709091440396
@carldebilly / @jeromelaban I've update the playground to include basic intellisense and error highlighting (see attached gif)

@MelbourneDeveloper
Copy link

@nickrandolph amazing!

@jeromelaban
Copy link
Member

@nickrandolph loving this !!Very nice work :)

@jeromelaban jeromelaban merged commit debc30c into unoplatform:canaries/dev Nov 12, 2020
@CyborgDE
Copy link

CyborgDE commented Mar 17, 2021

Is not working in the current version :-(
https://playground.platform.uno/

I figured out, I have to desantize the result :
var registerCompletionItemProvider = (languageId, characters) =>
monaco.languages.registerCompletionItemProvider(languageId,
{
triggerCharacters: characters,
provideCompletionItems: (model, position, context, token) => callParentEventAsync(
"CompletionItemProvider" + languageId,
[JSON.stringify(position), JSON.stringify(context)]).then(result => {
if (result) {
return JSON.parse(desantize(result));
}
return null;
}),
resolveCompletionItem: (item, token) => callParentEventAsync("CompletionItemRequested" + languageId,
[JSON.stringify(item)]).then(result => {
if (result) {
return JSON.parse(desantize(result));
}
return null;
})
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants