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

macOS vs GeanyLua #41

Closed
Syntonica opened this issue Jan 7, 2023 · 9 comments
Closed

macOS vs GeanyLua #41

Syntonica opened this issue Jan 7, 2023 · 9 comments

Comments

@Syntonica
Copy link

I was disappointed to find that the Lua plugin is not available on the Mac side of things. I really just need it for one thing--auto imports in Java so I don't have to memorize which package every Java class is in. This is the one thing keeping me from deleting Eclipse from my computer entirely, which I'd really love to do. Terrible editor.

Before I start the long laborious process of getting source for Geany, GTK, the Lua JIT, I think maybe Scintilla, but it was a lot of stuff just for compiling a tiny plugin--

  1. Does anybody know why it was not converted over originally? Coding fatigue, a little bit of bitrot, or some major, time-consuming issue?

  2. Is there another way of doing this? I have the ctags files installed for autocomplete, which I rarely use, and calltips, which I never use, but sadly, there's no package information in them. I don't mind typing the import line in, but something to tell me JTables are in javax.swing,* would be nice.

@elextr
Copy link
Member

elextr commented Jan 7, 2023

A couple of comments:

  1. I don't think the person who supports Geany on macos uses Lua, so has no need for the plugin.
  2. a package for Lua 5.1 (the only version the plugin supports AFAICT) is needed
  3. if no package is available for macos it will have to be created from source, much more effort for a plugin the maintainer doesn't use
  4. unless it has exactly the same API as Lua 5.1 its plain Vanilla Lua interpreted, not Luajit you need.
  5. You probably don't need Geany source, AFAICT the plugin API headers are installed by the bundle already, and you only need to link with Geany
  6. I don't think you need all of GTK, the plugin build only seems to need gmodule
  7. Scintilla is in Geany sources, so again all you need is the API headers which the bundle should install

Hmm, seems a "couple" == 7 today

As an alternative why not just write a command line program (in Java even) to spit out the info and bind it to a custom command in Geany.

Or just don't use Java [paid political message from all the other languages ;-)]

@Syntonica
Copy link
Author

That still sounds like too many bits and pieces to collect. I was probably looking at the compilation instructions for the entire plugin package. I don't care much for mucking about in other people's code. Last time I did that, I ended up rewriting the entire thing.

I was thinking of just using a really, really, REALLY long snippets file. Or, maybe a short one that just has my most commonly used imports. I can just add snippets as needed. I've also thought about using reflection, but I don't want to spin up the JVM just for that. Same issue with the Java LSP.

I use Java for a couple of desktop programs and utilities and it's my "relaxation" language. I've easily moved all my projects out of Eclipse (which causes me more stress than relaxation) and into Geany using simple make files, once I sat down and learned the basics of make. I desperately want to get rid of Eclipse as it's truly the worst editor I've ever used. It's pretty poor as an IDE, too. I think I can do better and simpler with make than Apple does with their 250K build files.

My next goal is to move my Xcode projects over to Geany, but they are audio plugins, individually mixes of C++, Obj-C and Obj-C++, so I need to sit down and learn compiler flags. Xcode is pretty bad as an editor and as an IDE.

Anyway, enough about my travails. Thanks for taking the time to reply.

@elextr
Copy link
Member

elextr commented Jan 7, 2023

and it's my "relaxation" language

Each to their own :-)

I know almost no Java, so can't add anything enlightening there.

As for C++, my personal observations of Geany, Eclipse and Vscode (all on Linux, no xcode) are that Geany is the best editor, then Eclipse, and Vscode is a pretty simple but adequate editor.

But treat Geany as a C++ editor, not as an IDE. This is not to criticise, but its no benefit to users or Geany if users have unrealistic expectations which lead to disappointment. To emphasise this relates to C++, not C or other programming languages.

There have been heroic efforts of the uctags crew developing a new C/C++ parser and @techee incorporating it in Geany. This has resulted in significant improvements in the as yet unreleased version of Geany. But C++ has largely outpaced the simplistic C biased tags paradigm. Overloading, auto and type inference, template instantiations, the amount of inline code in headers etc are just too complex for a system that does not track what STL or user includes have been included (since it does not understand the build system, be it make, Cmake, meson, etc) nor proper scope based symbol visibility. So the result is a pretty poor experience (IMNSHO) with autocompletes, variable and type highlighting, templates, and other C++ language specific features in Geany when using it for "real" projects.

Note that both Eclipse and Vscode give similarly poor results if using a build system that they don't understand, but if its make, Cmake, maybe meson, they are both pretty good with C++ features.

My personal feeling is that I agree with you that even though it works, Eclipse is big and clunky, and sometimes too intrusive, especially for Python support. Vscode seems to have a lighter touch, but YMMV, its still an IDE.

Anyway, enough about my travails. Thanks for taking the time to reply.

Its useful to have user experience relative to other tools provided (not just gripes or feature demands ... erm requests), we don't get enough. There is a discussion on the Geany repo about future plans (unanswered so far, bad timing asking during the holidays) and this sort of information is useful for an analysis of where Geany is and might go, so thanks for your time too.

@techee
Copy link
Member

techee commented Jan 7, 2023

Before I start the long laborious process of getting source for Geany, GTK, the Lua JIT, I think maybe Scintilla, but it was a lot of stuff just for compiling a tiny plugin--

You basically just need to follow the instructions here:

https://github.com/geany/geany-osx#readme

It downloads all the dependencies for you. It's not just getting GTK, but also all the dependencies of GTK itself (prepare for about 1-hour build).

Does anybody know why it was not converted over originally? Coding fatigue, a little bit of bitrot, or some major, time-consuming issue?

I think I just didn't even try. Basically I just compiled the plugins that didn't have any external dependency (with some exceptions - I wanted git-changebar to work which requires libgit). Maybe it's very easy, maybe you run into some unpredictable issues, who knows.

If you enable JIT in LUA, you should add the corresponding flag mentioned here

https://developer.apple.com/documentation/security/hardened_runtime

into https://github.com/geany/geany-osx/blob/master/geany.entitlements as the binary uses hardened runtime (you shouldn't need this for development, only when you decide to make the resulting bundle).

@Syntonica
Copy link
Author

I think I just didn't even try. Basically I just compiled the plugins that didn't have any external dependency (with some exceptions - I wanted git-changebar to work which requires libgit). Maybe it's very easy, maybe you run into some unpredictable issues, who knows.

Thanks for the reply. It's sounds like coding fatigue set in. I glanced over the build instructions and there was quite a bit there. I'll look it all over later and see what's going on. Maybe I can get all of the plugins compiled. But no promises! :)

@Syntonica
Copy link
Author

Its useful to have user experience relative to other tools provided (not just gripes or feature demands ... erm requests), we don't get enough. There is a discussion on the Geany repo about future plans (unanswered so far, bad timing asking during the holidays) and this sort of information is useful for an analysis of where Geany is and might go, so thanks for your time too.

My experiences with Geany have, on the whole, been very positive. The docs are frustrating to me, but only because the information tends to be terse, sparse or well-scattered. It wasn't until I got into the wiki that most of my burning questions were answered. Adding tags, make and astyle have filled in the gaps. Now, if I can get Lua.

I first found Geany when I needed something that was Pascal-friendly. I converted an audio plugin to pure Free Pascal to see how it fared. At the time, I was dealing with 4 different languages (throw in the old resource compiler from Carbon days!) Unfortunately, the optimization wasn't there--the optimized Pascal version was slower than the un-optimized C++ version. I could have optimized the code further, but it would have meant doubling the code base for unknown gains.

I quite enjoyed the simplicity of Geany. Pascal needs no build system--just a main file that pulls in everything else. I also started running little single-file C speed tests as well to see how clang handled certain things. Geany is handy and doesn't give me any backtalk.

I've tried Kate, but there's issues with the KDE GUI (Kate keeps expanding until she's well beyond the screen boundaries.) I've tried VS Code. Spent an hour going through the settings and still couldn't get all the annoying popups turned off. If I want popups, I'll open my browser and pick a site at random. I spent a month writing my own VIM init and had everything I needed in 300 lines of code with no plugins. But after I discovered that there was the Super Magical Girl Shoujo Regex Special mode, I threw it all away in a fit of pique. Who needs three or four regex modes, all based on context? I wish I hadn't deleted my script, now. I've been poking at NeoVim recently.

As for IDEs, I really don't need much. I don't use autocomplete or call tips much at all and prefer to ba able to call them u[ as needed. Make can do every thing I need to clean, compile, organize and run my projects. I think I'll still need Xcode for editing .plists (no way I could ever remember those options), but the less I need to open it, the better. It's annoying that I can go in and throw out all the iOS stuff I don't use or need anymore, so Xcode now takes up 25 some Gb on my hard drive.

As an aside, the biggest problem with Java? I think they have a Dept of Stupid names. I was thinking Java really needs closures, like C# has. And voila! They announce... Lambdas! (But they're really closures...) I also needed mixins at one point. And voila! Default methods! lol what? (I know, they're not exactly the same thing...)

@techee
Copy link
Member

techee commented Mar 3, 2023

OK, so I had a detailed look at what the problems with building this plugin might be and did run into these two issues:

  1. lua is only built as a static library by the provided makefile and GeanyLua checks for the dynamic library of lua provided by distributions. I think this isn't a big problem to overcome and the plugin should be easy to patch to link against the static library.
  2. For some reason, the plugin tests key presses using X11 instead of Gdk here:
    https://github.com/geany/geany-plugins/blob/2665511f731e613944815ab62885ecf52e3037e6/geanylua/glspi_app.c#L452
    Not sure if it's necessary and if something in Gdk is missing but this could be a problem for X11-less linuxes too. Maybe the whole "keygrab" code could be just dropped and this functionality removed from the plugin on macOS.

@techee
Copy link
Member

techee commented Mar 6, 2023

@Syntonica I've just created an arm64 binary of Geany with the Lua plugin enabled:

https://download.geany.org/snapshots/geany-1.38_osx_arm64.dmg

Would you give it a try? If you have a x86_64 mac, please let me know and I'll create a binary for it too.

@techee
Copy link
Member

techee commented Mar 25, 2023

I've just made the following builds:

Geany 1.38 built with the latest GTK and other dependencies, including some extra fixes which I plan to release as the official macOS build on the Downloads page unless there are some problems with it:
https://download.geany.org/snapshots/geany-1.38_osx-5.dmg
https://download.geany.org/snapshots/geany-1.38_osx_arm64-2.dmg

Like the above but Geany and plugins are from current git master:
https://download.geany.org/snapshots/geany-1.38_osx.dmg
https://download.geany.org/snapshots/geany-1.38_osx_arm64.dmg

Both of these builds contain the Lua plugin and it seems to be working alright.

@techee techee closed this as completed Mar 25, 2023
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

No branches or pull requests

3 participants