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

Add Editor Syntax Highlighting #104

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from

Conversation

gaetanomatonti
Copy link

@gaetanomatonti gaetanomatonti commented Aug 5, 2021

Description

This PR adds syntax highlighting to the JSON editor.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Screenshots

image

@gaetanomatonti gaetanomatonti changed the title Experimental/editor syntax highlighting Add Editor Syntax Highlighting Aug 5, 2021
@gaetanomatonti gaetanomatonti linked an issue Aug 5, 2021 that may be closed by this pull request
@gaetanomatonti gaetanomatonti added the feature Feature pull request label Aug 5, 2021
gaetanomatonti and others added 3 commits August 5, 2021 13:07
@gaetanomatonti gaetanomatonti marked this pull request as ready for review August 5, 2021 14:26
@gaetanomatonti gaetanomatonti changed the base branch from main to develop August 5, 2021 14:26
@FabrizioBrancati FabrizioBrancati added this to the Mocka 0.2.0 milestone Aug 27, 2021
Sources/App/Extensions/JSONLexer.swift Show resolved Hide resolved
.frame(maxWidth: .infinity, alignment: .leading)
.font(.headline)
.foregroundColor(Color.latte)
VStack(spacing: 16) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 16? Does this component look different from the previous one?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

previously it was 10, I just raised it to be a multiple of 4.

Sources/App/Views/Common/Editor.swift Outdated Show resolved Hide resolved
import SwiftUI

/// A source code editor with custom theme.
struct MockaSourceCodeTextEditor: NSViewRepresentable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
struct MockaSourceCodeTextEditor: NSViewRepresentable {
struct SourceCodeTextEditor: NSViewRepresentable {

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SourceCodeTextEditor is the name of the View component provided by Sourceful

Comment on lines +24 to +26
fieldsSection

headersSection
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you create these vars?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to clean up the body a little bit, I found it a bit hard to read. we can remove them if you prefer

@@ -21,6 +21,10 @@ packages:
Vapor:
url: https://github.com/vapor/vapor
from: 4.0.0
Sourceful:
url: https://github.com/twostraws/Sourceful
branch: main
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no releases available?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

releases are way behind main

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

Successfully merging this pull request may close these issues.

Code Highlighting in Editor
2 participants