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

Run files without extension (using code-runner.defaultLanguage) #273

Closed
caub opened this issue Mar 14, 2018 · 6 comments
Closed

Run files without extension (using code-runner.defaultLanguage) #273

caub opened this issue Mar 14, 2018 · 6 comments
Labels

Comments

@caub
Copy link
Contributor

caub commented Mar 14, 2018

I'd like to run files without extensions, typically bash scripts using your great code-runner extension

Currently it works if a script has the .sh extension, not without (which is more usual for scripts)

Is this possible to implement?

it could respect default language setting for those files

"code-runner.defaultLanguage": "shellscript",

running ./foo or bash foo or sh foo work in the terminal, before you ask (the file has the right permissions)

@caub caub changed the title Allow files without extension to be ran (by code-runner.defaultLanguage) Run files without extension (using code-runner.defaultLanguage) Mar 14, 2018
@formulahendry
Copy link
Owner

I think you could use code-runner.customCommand.

@caub
Copy link
Contributor Author

caub commented Mar 18, 2018

@formulahendry thanks, but I'd need a different shortcut to run it, not very practical

It's very common that bash/shell script are extension-less, so it would be great that it uses the defaultLanguage when there is no extension (that's the behavior with sublime-text). I cloned the repo, looked at the sources, but didn't find why it wasn't working. How can I load your extension locally instead of the marketplace one to test?

things I'd like to work on

  • add tests
  • run files with no extension using defaultLanguage mapping
  • try to read a possible hashbang in that case

@formulahendry
Copy link
Owner

Sorry, I am not very clear about you requirement. Could you please share more details? What's the current behavior? And what's your expected behavior?

To debug the extension, just clone the repo, run npm install, then press F5.

@caub
Copy link
Contributor Author

caub commented Mar 19, 2018

2018-03-19-131031_1354x1040_scrot

2018-03-19-131156_1354x1039_scrot

my code-runner settings:

	"code-runner.saveFileBeforeRun": true,
	// "code-runner.runInTerminal": true,
	"code-runner.clearPreviousOutput": true,
	"code-runner.defaultLanguage": "shellscript",
	"code-runner.enableAppInsights": false,
	"code-runner.showExecutionMessage": true,
	"code-runner.executorMap": {
		"sql": "psql -U postgres -f",
		"bash": "bash"
	},

I'd want to still be able to run the lol file, like I would run it if it were lol.sh or lol.bash

@formulahendry
Copy link
Owner

Oh! This is a bug of the extension.

@formulahendry
Copy link
Owner

Hi @caub , this issue has been fixed, please try the latest version.

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

No branches or pull requests

2 participants