Code Monkey home page Code Monkey logo

codemirror-swift's People

Contributors

khoi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

codemirror-swift's Issues

Minor Issues Affecting Compilation (Solutions Provided)

Thanks for putting this package together!

I've run into a couple of issues I wanted to make you aware of. [I considered opening a separate issue for the compilation issues, vs. the SPM package search issue - you will probably want to track them separately. But I don't want to clutter your issues list.]

Ambiguous Package Name

When I try loading your package Xcode points to a different package than the url you provided, my guess is that both these packages are being searched for in a non-case-specific way, so they look the same. (CodeMirror-Swift vs codemirror-swift)

I specify https://github.com/khoi/codemirror-swift, but this link appears in Xcode
https://github.com/ProxymanApp/CodeMirror-Swift - which does not use CodeMirror 6.0

Compilation Errors

I tried using your url inside a Package.swift file in a local package instead [this worked], and the package doesn’t compile due to these errors:

CodeMirrorWebView.swift:39:43: error: cannot find type 'NSRect' in scope
and
CodeMirrorWebView.swift:39:21: error: initializer does not override a designated initializer from its superclass

It looks like these two lines need to conditionally compile based on when using AppKit, vs using UIKit/SwiftUI.

Something like this would solve that:

#if os(OSX)
    import AppKit
    public typealias NativeRect = NSRect
#elseif os(iOS)
    import UIKit
    public typealias NativeRect = CGRect
#endif

There's a third issue with the main module, which I haven't researched/resolved, so I'm using a workaround:

CodeMirrorWebView.swift:98:17: error: value of type 'WKWebView' has no member 'allowsMagnification'

Since WKWebView does not have an allowsMagnification property, I commented it out.

With these errors corrected, the test module fails:

codemirror-swift-main/Tests/CodeMirrorTests/CodeMirrorTests.swift:10:24: error: cannot call value of non-function type 'module<CodeMirror>'
        XCTAssertEqual(CodeMirror().text, "Hello, World!")

By commenting out the assertion I did get a successful compile. This is not a final solution but it allows me to try to actually use your package.

I'll let you know how I make out when I swap in your package to my existing app (which uses CodeMirror 5.x).

After making those 3 changes the package successfully compiles

SwiftUI support

It should be trivial to implement one, I never find the need for it so if you're reading this, please submit a PR πŸ™‡

How to change the font size of the editor?

I've been researching the documentation and online examples of how to change the font size, but most of the information I can find is very old and applies to CodeMirror 5. I'm using this package with CodeMirror 6 now but cannot figure out how to provide the ability to dynamically change the font size. I want a font size slider to control the font size.

If I put a fontSize: 13pt; item into the baseTheme constant then I can see the new font size. But I want to make that dynamic.

Do you know how to do that?

Extend autocompletions

I'd like to be able to add in my own autocompletions to the list of available ones.

Do you know how to do that? The documentation on the CodeMirror 6 website is not very clear on how to put it all together.

I've been trying to put some of the examples into your editor.js file, but I end up getting compile errors.

Do you know how to extend the list of autocompletions?

Update to latest CodeMirror 6.x version?

Would it be possible to update CodeMirror to the latest 6.x version? There's a function in there I'm trying to use called scopeCompletionSource, but it doesn't seem to be available in this version.

I'm trying to configure autocomplete to trigger when you type in the . character and then display a list of context sensitive completions pertaining to the token typed before the .

Here's a link to the mention of it:

https://github.com/codemirror/lang-javascript/#user-content-scopecompletionsource

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.