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

✨ Tasks (Run scripts in the shell) #262

Closed
Angelk90 opened this issue Mar 26, 2022 · 14 comments · Fixed by #1798
Closed

✨ Tasks (Run scripts in the shell) #262

Angelk90 opened this issue Mar 26, 2022 · 14 comments · Fixed by #1798
Assignees
Labels
enhancement New feature or request extensions Issues related to the extension architecture in CodeEdit
Milestone

Comments

@Angelk90
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Registrazione.schermo.2022-03-26.alle.09.30.34.mov

You know that XCode has a menu like this, which allows you to run tests and other things as well as run the program.

It would be useful to have something like this, but which allows you to run scripts found in the package.json file.

Script package.json example:

"scripts": {
    "typescript": "tsc --noEmit",
    "lint": "eslint \"**/*.{js,ts,tsx}\"",
    "lint-ci": "yarn lint -f ./node_modules/@firmnav/eslint-github-actions-formatter/dist/formatter.js",
    "build": "bob build",
    "release": "release-it",
    "pods": "cd example && yarn pods",
    "bootstrap": "yarn && cd example && yarn && yarn setup && yarn pods",
    "check-android": "scripts/ktlint.sh && scripts/cpplint.sh",
    "check-ios": "scripts/swiftformat.sh && scripts/swiftlint.sh",
    "check-js": "yarn lint --fix && yarn typescript",
    "check-all": "scripts/check-all.sh",
    "clean-ios": "scripts/clean-ios.sh",
    "clean-android": "scripts/clean-android.sh",
    "clean-js": "scripts/clean-js.sh",
    "docs": "cd docs && yarn build"
  }

Describe the solution you'd like
So if the project contains a package.json file it tries to read it, if it finds any scripts, it puts them in the menu to let you run them.
When one of the scripts is pressed, it starts the script in a new shell.

@Angelk90 Angelk90 added the enhancement New feature or request label Mar 26, 2022
@pkasila
Copy link
Member

pkasila commented Mar 26, 2022

@jasonplatts, I think that it's related to #76

@Angelk90
Copy link
Contributor Author

@pkasila : I don't know, do you think such a thing could be useful?
Do you see it more as a plugin?

@lukepistrol
Copy link
Member

My take on this is that we should enable it in our plugin API so plugin developers can choose what action they want to perform on "play". Similar to how VSCode handles it.

@pkasila
Copy link
Member

pkasila commented Mar 26, 2022

As @lukepistrol said, we implement API for extensions to provide targets, tests and so on. So, NodeJS extension reads package.json and creates npm start target and anything else using Extension API and these targets appear in the UI

@jasonplatts
Copy link
Collaborator

Yeah, I agree. It seems like it might be better as an extension. Nova offers tasks, https://docs.nova.app/extensions/run-configurations/.

@jasonplatts jasonplatts added the extensions Issues related to the extension architecture in CodeEdit label Mar 27, 2022
@jasonplatts jasonplatts changed the title [FEAT] - Run scripts in the shell [FEAT] Tasks (Run scripts in the shell) Mar 27, 2022
@jasonplatts
Copy link
Collaborator

As @lukepistrol said, we implement API for extensions to provide targets, tests and so on. So, NodeJS extension reads package.json and creates npm start target and anything else using Extension API and these targets appear in the UI

Here is the link to VS Code tasks. https://code.visualstudio.com/docs/editor/tasks

@austincondiff austincondiff changed the title [FEAT] Tasks (Run scripts in the shell) ✨ Tasks (Run scripts in the shell) Mar 31, 2022
@jasonplatts
Copy link
Collaborator

Overview

The Task Provider should allow extension developers to define external tools that can be run from a CodeEdit menu option and the command palette. These tasks should be capable of running command line tools, such as Grunt, npm, Rake, Gulp, etc. Results from running these tasks should appear in the console within CodeEdit.

Resources

https://code.visualstudio.com/docs/editor/tasks
https://code.visualstudio.com/api/extension-guides/task-provider

@stale stale bot added the wontfix This will not be worked on label Jun 3, 2022
@CodeEditApp CodeEditApp deleted a comment from stale bot Jun 3, 2022
@stale stale bot removed the wontfix This will not be worked on label Jun 3, 2022
@stale stale bot added the wontfix This will not be worked on label Aug 2, 2022
@CodeEditApp CodeEditApp deleted a comment from stale bot Aug 2, 2022
@stale stale bot removed the wontfix This will not be worked on label Aug 2, 2022
@jenslys
Copy link

jenslys commented Jan 24, 2023

Are we going to do something like Nova, where you have to create a custom task for each project? When trying out Nova, I found it annoying to have to create a custom task for each project I go into.

it8nfQsmzwwXnvD1QSTjMsnPorJ59VZuLBWdsxwT

In VS Code, npm scripts have a separate window.

image

And for other files like Python and vanilla JS, I use vscode-code-runner so I can just press the play button in the corner to start debugging.

qLLtjZyBGJ2RYgwwaMSqgVS8wx9md6FSZGOCNbeF

@jacob-carlborg
Copy link

Are we going to do something like Nova, where you have to create a custom task for each project? When trying out Nova, I found it annoying to have to create a custom task for each project I go into.

I think that's annoying too. I really like how it works in TextMate. There's a convention that a bundle provides a Run and/or Build command. They all are named the same and all use the same keyboard shortcuts. For something like Ruby it will just run the current file. For RSpec there are a couple of commands. The regular Run command runs all tests in the current file. Then there are commands for running a single test within a file and to run all tests in the selected directory. I'm using this feature very frequently. I just need to verify a couple lins of code, I open a new document type the code and run it, I don't even need to save the document for it to work. Super convenient.

For the D programming language I made the default Run command a bit smart. If there's a standalone file open, it will just compile and run the resulting executable. If there's a project directory open, it will look for the for a run.sh file in the directory and execute that if present. Otherwise it will look for a build configuration file, run the build tool and then the resulting executable. Finally, if none of those files are present it will behave as a standalone file is open. In addition to that there's a Run Single File command that will always only compile and run the current file, regardless if a directory is open or if it's a standalone file.

This would be create if it could be supported. Either by convention or by an API. Also, I wouldn't mind if it was possible to support project specific configurations. For the D Run command, I'm using the run.sh approach as a workaround for the lack of project specific configurations in TextMate. This allows to pass arguments to the executable.

@austincondiff austincondiff moved this from 🆕 New to 💬 Needs Clarification in CodeEdit Project Feb 17, 2023
@austincondiff austincondiff moved this from 💬 Needs Clarification to 📋 Backlog in CodeEdit Project Mar 4, 2023
@iggy890
Copy link
Contributor

iggy890 commented Mar 15, 2023

I'm taking my hand at this and on discord there is general agreement that there should be some kind of configuration that users can access on how the project is run, how should this be implemented?

@lukepistrol
Copy link
Member

@iggy890 I don’t want to step on your toes with this but based on your latest commits in PRs I think this is better suited for a more experienced developer since this will be an important part of the app and most possibly it needs to align with our yet-to-come extensions API.

@iggy890
Copy link
Contributor

iggy890 commented Mar 16, 2023

@iggy890 I don’t want to step on your toes with this but based on your latest commits in PRs I think this is better suited for a more experienced developer since this will be an important part of the app and most possibly it needs to align with our yet-to-come extensions API.

That makes sense my basic implementation is here (someone could continue it here just create a PR or DM me on discord and I'll add you as a contributor to that branch): https://github.com/iggy890/CodeEdit/tree/run-code

@Angelk90
Copy link
Contributor Author

@lukepistrol : I'd give @iggy890 a chance, creating an initial base wouldn't be bad.

@jenslys
Copy link

jenslys commented Apr 3, 2023

Small suggestion adding to my prev comment: #262 (comment):

Screenshot

Screenshot 2023-04-03 at 16 53 50@2x

like IntelliJ, the standard option is just to run the current file.
but if you want to have some custom configuration, you can create a new configuration file for that workspace with the dropdown. but it defaults to just running the current file

Screenshot

Screenshot 2023-04-03 at 16 59 58@2x

Codeedit would need to have some custom task.json file that would read the custom config.
Don't know how npm scripts would work, identify npm start as standard?

@tom-ludwig tom-ludwig self-assigned this Jun 13, 2024
@tom-ludwig tom-ludwig added this to the v0.2.0 milestone Jun 13, 2024
@tom-ludwig tom-ludwig mentioned this issue Jul 5, 2024
6 tasks
@github-project-automation github-project-automation bot moved this from 📋 Backlog to 🏁 Complete in CodeEdit Project Jul 27, 2024
xinix909 pushed a commit to xinix909/CodeTransfer that referenced this issue Sep 7, 2024
Bumps CETV to 0.7.6.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request extensions Issues related to the extension architecture in CodeEdit
Projects
Status: 🏁 Complete
Development

Successfully merging a pull request may close this issue.

8 participants