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

Integration with IDE #18

Closed
glitchcore opened this issue Aug 17, 2020 · 15 comments
Closed

Integration with IDE #18

glitchcore opened this issue Aug 17, 2020 · 15 comments
Labels
Feature Request New feature or user-story you wanna add to flipper

Comments

@glitchcore
Copy link
Contributor

Now we're using docker for build. It have some pros:

  • user doesn't need to setup environment: install compilers, libraries, etc.
  • container can be used for CI

I use sublime editor for programming, but I understand that many people used to use IDE like CLion/Eclipse/etc. How do we make integration?

@glitchcore glitchcore added Feature Request New feature or user-story you wanna add to flipper Area:Firmware#Building labels Aug 17, 2020
@reendael
Copy link

The latest version of CLion (2020.2) introduces proper support for makefile-based projects and removes the necessity to use CMake to unlock the power features of the IDE. CLion seems to process the current repo out of the box (albeit I have the toolchain config already set up), code navigation and insights work very well. When the development hardware becomes available, setting up remote debugging with OpenOCD should either be automatic or pretty easy to set up.

Having said that, switching to CMake at this point when the repo is malleable is also an option.

@glitchcore
Copy link
Contributor Author

Can CLion call external script (likedocker-compose) to build project?

@hp197
Copy link
Contributor

hp197 commented Aug 28, 2020

Can CLion call external script (likedocker-compose) to build project?

Yes, it can call external scripts, but there is no real integration yet for docker with clion (real integration is on the roadmap).
Currently what you need to do is run a pre build script to launch a docker container and then deploy/build your code remotely over ssh in that docker container.

@glitchcore
Copy link
Contributor Author

It will be great to add CLion/Idea integration if it don't require massive changing project structure and build system.

@neshkeev
Copy link
Contributor

How about creating a Language Server Protocol (LSP) so users can connect to it from any editor/IDE they want?

@neshkeev neshkeev mentioned this issue Aug 29, 2020
@glitchcore
Copy link
Contributor Author

How about creating a Language Server Protocol (LSP) so users can connect to it from any editor/IDE they want?

Interesting idea, I never use it before. We must start LSP server inside docker and IDE can connect to it?

@neshkeev
Copy link
Contributor

We must start LSP server inside docker and IDE can connect to it?

LSP is a protocol, which means that if a client implements the protocol, it can work with any LSP server it wants to bring the IDE like experience into an editor/IDE, like autocomplete, navigation, errors, etc. The client usually is implemented as a plugin. I believe that the server can't be inside of a docker container, because it needs to have access to the file system to read a project's files. It can be just a process and a client can start/stop/restart an LSP server. Needless to say that each language should implement its own LSP server. So we will need to implement one, and any editor with an LSP plugin can work with it.

All the popular text editors/IDEs should already have a plugin that implements a client for LSP in their plugin repositories.

I used it with emacs + Rust LSP and vscode + Scala 3 LSP. No special plugins for a client were necessary, it was just a generic LSP client. The LSP servers fail sometimes and all the IDE-like features stopped working, I had to restart the server to get them back to work (which was annoying).

@glitchcore
Copy link
Contributor Author

believe that the server can't be inside of a docker container, because it needs to have access to the file system to read a project's files.

But we have project dir mounted into container for build. I prefer to run server in docker because user shouldn't run something on its machine and shouldn't install something.

Is there a ready for use LSP servers exist?

@nikita-b
Copy link
Contributor

Can CLion call external script (likedocker-compose) to build project?

Yes, it can call external scripts, but there is no real integration yet for docker with clion (real integration is on the roadmap).
Currently what you need to do is run a pre build script to launch a docker container and then deploy/build your code remotely over ssh in that docker container.

But IDE will not see libraries, compilers and so on if I understand correctly.

If we want to use SSH, maybe sshfs will be helpful: https://github.com/libfuse/sshfs
(Windows version: https://github.com/billziss-gh/sshfs-win)

Or maybe we just can mount directory to host?
For example, we have two directories /source /source-tmp and script prepare_enviroment.(sh\py).

  1. Run script
  2. Script copy files from /source to /source-tmp
  3. Run container that mount directory from container to /source
  4. Copy files from /source-tmp to /source
  5. ...
  6. Profit!

Also, Remote Development feature looks really promising: https://blog.jetbrains.com/clion/2018/09/initial-remote-dev-support-clion/#remote_development_what_can_i_do
(Maybe you mean exactly that and I just didn't understand)

@neshkeev
Copy link
Contributor

But we have project dir mounted into container for build.

Mounting a project's directory into a docker container should work. The start command for the container becomes more complicated and that's it.

Is there a ready for use LSP servers exist?

There are plenty of LSP implementations, most of them are open source, we can fork one so we don't need to build everything from ground up. You might be interested in rust, for sublime you can use this plugin

@glitchcore
Copy link
Contributor Author

But IDE will not see libraries, compilers and so on if I understand correctly.

why? You can start docker by docker-compose up -d && docker-compose exec dev bash right now and get full environment with compilers, tools and project source mounted to /project.

Did I understand correctly that LSP is the alternative to SSH-into-container and remote developement?
I have the following idea of how it should work:

  • user start docker container by docker-compose up -d
  • LSP server starts at container startup
  • user install LSP plugin for his editor and specify port that container is exposed
  • ???
  • PROFIT111

What about debugging features integration?

@glitchcore
Copy link
Contributor Author

@neshkeev are you ready to integrate LSP into our image?

@glitchcore
Copy link
Contributor Author

Look at VSCode + docker integration: https://github.com/MuratovAS/VScode_Docker_Stm32

@glitchcore
Copy link
Contributor Author

Everyone feel good with current environment? What IDE are you using?

If this issue makes no sense, I will close it after 2 oct 14:00 UTC.

thzinc pushed a commit to thzinc/flipperzero-firmware that referenced this issue Jun 26, 2022
@gelin
Copy link

gelin commented Nov 12, 2022

+-------------------------------------------------+
|                                                 |
|      Hello, this is Flipper team speaking!      |
|                                                 |
|       We've migrated to new build system        |
|          It's nice and based on scons           |
...

😢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request New feature or user-story you wanna add to flipper
Projects
None yet
Development

No branches or pull requests

6 participants