I've got both Leiningen & Clojure working on Windows 8 separately from Sublime Text (e.g. I can get a repl working in Windows PowerShell).
My problem is that I can't get the SublimeREPL working in SublimeText (the REPL loads up but doesn't then do anything). Are there any simple traps that I might be missing or, failing that, are there a series of steps I could follow to troubleshoot?
Please see this SublimeREPL issue for instructions on how I got a Clojure REPL to work, at least on XP (I haven't tried it on Win7 or 8 yet). Basically, I edited the menu file for Clojure, and changed the command from lein repl to lein trampoline run -m clojure.main, which for some reason did the trick. I also changed the path to $file so you can open up a REPL while your project.clj is the current tab in Sublime, and the REPL should inherit the project's settings.
For reference, the complete Packages/User/SublimeREPL/config/Clojure/Main.sublime-menu file (Packages is accessible via Preferences -> Browse Packages...) is as follows:
[
{
"id": "tools",
"children":
[{
"caption": "SublimeREPL",
"mnemonic": "r",
"id": "SublimeREPL",
"children":
[
{"caption": "Clojure",
"id": "Clojure",
"children":[
{"command": "repl_open",
"caption": "Clojure Trampoline",
"id": "repl_clojure",
"args": {
"type": "subprocess",
"encoding": "utf8",
"cmd": {"windows": ["lein.bat", "trampoline", "run", "-m", "clojure.main"],
"linux": ["lein", "repl"],
"osx": ["lein", "repl"]},
"soft_quit": "\n(. System exit 0)\n",
"cwd": {"windows":"$file_path",
"linux": "$file_path",
"osx": "$file_path"},
"syntax": "Packages/Clojure/Clojure.tmLanguage",
"external_id": "clojure",
"extend_env": {"INSIDE_EMACS": "1"}
}
},
{"command": "clojure_auto_telnet_repl",
"id": "repl_clojure_telnet",
"caption": "Clojure-Telnet"}]}
]
}]
}
]
I solved this problem with Git Bash Shell. I have used the shell script version of leiningen instead of lein.bat
This is the command I use:
["C:\\Program Files\\Git\\bin\\sh.exe", "-l", "--", "/d/lein.sh", "repl"]
assuming lein.sh is in d:\
lein trampoline command sometimes behaves differently from lein repl and could fail due to unknown reasons.
Related
I'm using WSL2 on Windows terminal. I have an app that needs front end and backend booted before it can be used, so every time I nave to open a terminal window, navigate to a folder and run a command.
I would like to set an alias that would open a new tab, navigate to a folder and do go run .
I saw suggestions for linux, but none of those work on Windows Terminal with WSL2. Anyone have experience with this setup?
You could create a profile for this. Something like
{
"commandline": "wsl.exe -d Ubuntu ping 8.8.8.8",
"name": "backend",
"startingDirectory": "\\\\wsl$\\Ubuntu\\home\\zadjii\\path\\to\\project",
},
(of course, replace ping 8.8.8.8 with the actual command you want to run, replace Ubuntu with the name of the distro you're using, and replace home\\zadjii\\path\\to\\project with your actual path, delimited by double-backslashes.)
Now, if you wanted to get really crazy, you could create an action in the Command Palette which opened up multiple commands all at once:
{
"name": "Run my project",
"command": {
"action": "multipleActions",
"actions": [
// Create a new tab with two panes
{ "action": "newTab", "tabTitle": "backend", "commandline": "wsl.exe -d Ubuntu run_my_backend", "startingDirectory": "\\\\wsl$\\Ubuntu\\home\\zadjii\\path\\to\\backend" },
{ "action": "splitPane", "tabTitle": "frontend", "commandline": "wsl.exe -d Ubuntu run_my_frontend", "startingDirectory": "\\\\wsl$\\Ubuntu\\home\\zadjii\\path\\to\\frontend" },
]
}
}
see multipleActions
I've just installed WSL2 and am using the Windows Terminal on Win10 1909 (18363.1256). I'm trying to set up 2 different profiles, one that launches a local WSL2 Ubuntu shell, and one that launches another WSL2 shell that will automatically ssh to a specific host.
The local one works great, shows up without an issue, however I can't seem to get my 2nd profile to show up in the list of profiles.
My settings.json looks like this:
"profiles":
{
"defaults":
{
// Put settings here that you want to apply to all profiles.
"colorScheme": "One Half Dark",
"fontFace": "JetbrainsMono NF",
"fontSize": 11
},
"list":
[
{
"guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
"hidden": false,
"name": "Ubuntu",
"source": "Windows.Terminal.Wsl",
"startingDirectory": "//wsl$/Ubuntu/home/sensanaty",
"tabTitle": "WSL2"
},
{
"guid": "{15c5814b-7ed1-4cec-bc64-d165274958fa}",
"hidden": false,
"name": "External Host",
"source": "Windows.Terminal.Wsl",
"commandline": "ssh example#123.456.7.89",
"tabTitle": "External Host"
},
]
},
With the above, I only get the Ubuntu profile in my list
I thought maybe it was the guid generated or something, but I just did a simple uuidgen and pasted it into the json so it shouldn't really be causing any issues there. I've also obviously tried restarting my system, to no avail. The default profiles show up fine if I disable the option to stop auto-generating them, as well.
Any clue as to what might help me out?
The 'source' attribute is for dynamically generated profiles, for which WSL will create one for each instance installed. You can't control the command line for these dynamically generated profiles. What you need is for your new profile to extend the command line to tell Terminal to use WSL. Remove the 'source' attribute entirely, so that your new profile is static.
In your case, that should be ...
{
"guid": "{15c5814b-7ed1-4cec-bc64-d165274958fa}",
"hidden": false,
"name": "External Host",
//"source": "Windows.Terminal.Wsl",
"commandline": "wsl.exe ssh example#123.456.7.89",
"tabTitle": "External Host"
}//,
As bwolfbarn mentioned, you should also ditch that trailing comma if it really comes at the end of the "list" block.
Here are a few lines from mine as additional examples as well ...
{
"guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
"hidden": false,
"name": "Ubuntu 20.04 WSL2 tmux",
//"source": "Windows.Terminal.Wsl",
"commandline": "wsl.exe -d Ubuntu -e sh -c \"/usr/bin/tmux has-session -t main 2>/dev/null && /usr/bin/tmux attach-session -d -t main || /usr/bin/tmux -2 new-session -t main -s main -c ${HOME}\"",
"cursorShape": "filledBox"
},
{
"guid": "{4e04fa7e-76c7-4746-a322-a227e70dde6c}",
"hidden": false,
"name": "Ubuntu 20.04 WSL1 tmux",
//"commandline": "wsl.exe -d Ubuntu20.04_WSL1",
"commandline": "wsl.exe -d Ubuntu20.04_WSL1 -e sh -c \"/usr/bin/tmux has-session -t main 2>/dev/null && /usr/bin/tmux attach-session -d -t main || /usr/bin/tmux -2 new-session -t main -s main -c ${HOME}\"",
"cursorShape": "filledBox"
}
Note that you could, I believe, use "wsl.exe -e" (a.k.a. --execute), but it's not really necessary in your case.
If you want to see your "source": "Windows.Terminal.Wsl" in Windows Terminal Menu it must exist in the registry
[HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss\{UUID}]
(The registry UUID is not related to Windows Terminal UUID).
This registry entry can be created by running "wsl --import" or by cloning existing entry (if you are comfortable messing with the registry).
If you still don't see your profile after confirming that the registry entry exists, remove all entries for "generatedProfiles" in state.json file located in the same folder as settings.json. This will force Windows Terminal to update state.json. If you generated Windows Terminal profile UUID yourself, it may ignore it and create its own one. In this case you will see duplicate entries for the profile in settings.json. Remove the ones that were generated manually, and leave the one generated by the terminal.
At least the last comma should be removed (I commented it in your example) as the element "External Host" is the last of the list.
[
{
"guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
"hidden": false,
"name": "Ubuntu",
"source": "Windows.Terminal.Wsl",
"startingDirectory": "//wsl$/Ubuntu/home/sensanaty",
"tabTitle": "WSL2"
},
{
"guid": "{15c5814b-7ed1-4cec-bc64-d165274958fa}",
"hidden": false,
"name": "External Host",
"source": "Windows.Terminal.Wsl",
"commandline": "ssh example#123.456.7.89",
"tabTitle": "External Host"
}//,
]
I follow the https://code.visualstudio.com/api/get-started/your-first-extension tutorial, but when i came to "Then, inside the editor, press F5. This will compile and run the extension in a new Extension Development Host window." .I got a "building..." and nothing else.enter image description here
I have no idea what to do.
Please check if your launch.json inside the .vscode has configuration like following:
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
}
Also, try by re-installing all the packages before running F5.
My issues is, that VSC does not brake on a brake-point while debugging PhantomJS file..
There is only 1 js file. ! I did re-installed VSC, phantomjs, etc.. But no luck.?!
I did followed tutorial on GitHub, also googled about this issue, but still VSC just displays:
Unverified breakpoint, Breakpoint ignored because generated code not found (source map problem?)
My launch.json looks like this:
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "phantomjs",
"request": "launch",
"file": "C:/Users/TSS/Desktop/PhantomJS/bin/hello.js",
"webRoot": "C:/Users/TSS/Desktop/PhantomJS",
"runtimeExecutable": "C:/Users/TSS/Desktop/PhantomJS/bin/phantomjs.exe",
"runtimeArgs": [],
"scriptArgs": [],
"sourceMaps": true
}
]
}
Folders structure is also very simpple:
I just downgraded to older VSC version and it works.. For some reason !
I'm new to Grunt (and fairly new to sublime Text), but I've downloaded the excellent grunt build system and it works well every time I save. I'm on Win8 by the way.
The only problem is that it runs all tasks/targets. I have separated my tasks into "dist" and "dev" targets and I would like it to run only the dev tasks when I use it on save.
I'd then like to create a separate build task which I would use when building for production. Is this a sensible strategy?
Anyway, I just need to know how to modify the following build system file to just run tasks with the "dev" target....
{
"cmd": ["grunt", "--no-color"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${project_path:${folder:${file_path}}}",
"selector": "Gruntfile.js",
"windows":
{
"cmd": ["grunt.cmd", "--no-color"]
},
"variants":
[
{
"name": "Gruntfile",
"cmd": ["grunt", "--no-color"],
"windows":
{
"cmd": ["grunt.cmd", "--no-color"]
}
}
]
}
You first need to create an task that runs all the dev targets:
grunt.registerTask('dev', ['task:dev', 'task2:dev']);
This can be run from the command-line using: grunt dev
As for the Sublime build config, "cmd" is just an array of command-line arguments.
So it would end up like this:
{
"cmd": ["grunt", "dev", "--no-color"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${project_path:${folder:${file_path}}}",
"selector": "Gruntfile.js",
"windows":
{
"cmd": ["grunt.cmd", "dev", "--no-color"]
},
"variants":
[
{
"name": "Gruntfile",
"cmd": ["grunt", "dev", "--no-color"],
"windows":
{
"cmd": ["grunt.cmd", "dev", "--no-color"]
}
}
]
}
All you need to do is call Grunt by specifying it's complete path. Calling grunt alone fails, even though you have the grunt-cli installed and working from the cmd prompt. Note you need to have the environment variable for nodejs set.
Windows users create your my-project.sublime-builder file and put it in C:\Users\yourname\AppData\Roaming\Sublime Text\Packages\User. Apple/Unix location will be different.
The my-project.sublime-builder file looks like:
{
"cmd": "C:\\Users\\ronni\\AppData\\Roaming\\npm\\grunt.cmd",
"working_dir": "C:\\Users\\ronni\\documents\\my-project"
}