I have update my sublime3 to newest version, then I can't use hotkey to run my py files. Here is my hot key configuration:
[
{
"caption": "Tmpl: Create python",
"command": "sublime_tmpl",
"keys": ["ctrl+alt+p"], "args": {"type": "python"}
},
{
"keys":["f1"],
"caption": "SublimeREPL: Python",
"command": "run_existing_window_command", "args":
{
"id": "repl_python",
"file": "config/Python/Main.sublime-menu"
}
},
{
"keys":["f2"],
"caption": "SublimeREPL: Python - RUN current file",
"command": "run_existing_window_command", "args":
{
"id": "repl_python_run",
"file": "config/Python/Main.sublime-menu"
}
},
]
When I press F2 or F1, there is nothing happened.
It appears that Sublime Text 3 build 3200 has broken the run_existing_window_command command. As alluded to in this answer the solution is to instead invoke the command that the SublimeREPL menu item is using.
If you navigate to your Sublime Text 3 packages directory (AppData/Roaming/Sublime Text 3/ by default on Windows), you can see the packages you have installed. From this directory, if you open SublimeREPL/config/Python/Main.sublime-menu, you'll see a big ole json file that looks something like this:
[
{
"id": "tools",
"children":
[{
"caption": "SublimeREPL",
"mnemonic": "R",
"id": "SublimeREPL",
"children":
[
{"caption": "Python",
"id": "Python",
"children":[
{"command": "repl_open",
"caption": "Python",
"id": "repl_python",
"mnemonic": "P",
"args": {
"type": "subprocess",
"encoding": "utf8",
"cmd": ["python", "-i", "-u"],
"cwd": "$file_path",
"syntax": "Packages/Python/Python.tmLanguage",
"external_id": "python",
"extend_env": {"PYTHONIOENCODING": "utf-8"}
}
}
<---snip--->
]}
]
}]
}
]
Notice that the innermost children key is a list of dictionaries with commands and args. We're going to copy those into the sublime-keymap file and replace the command and args that are already there. For example, your shortcut to open a python REPL would now look like:
"keys": ["f1"],
"command": "repl_open",
"args": {
"type": "subprocess",
"encoding": "utf8",
"cmd": ["python", "-u", "$file_basename"],
"cwd": "$file_path",
"syntax": "Packages/Python/Python.tmLanguage",
"external_id": "python",
"extend_env": {"PYTHONIOENCODING": "utf-8"}
}
Hitting F1 should now work like it used to.
Related
I compiled v8 on Linux Min 20.2 using VsCode.
My build tasks.json task looks like this
"tasks": [
{
"label": "gm x64.debug all",
"type": "shell",
"command": "tools/dev/gm.py x64.debug all",
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "always",
"panel": "dedicated",
"clear": true
},
"problemMatcher": {
"fileLocation": [
"relative",
"${workspaceFolder}out/x64.debug/"
],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
}
launch.json config
{
"name": "(gdb) launch hello_world",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/out/x64.debug/v8_hello_world",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
Breakpoints working well also callstack is available but there is no local variables.
I use extension "C/C++ (by Microsoft)".
How I can enable them?
(V8 developer here.)
Inspecting local variables should work by default. You could try running the compiled binary in GDB to see if something is missing from the binaries, or it's an issue with VSCode's integrated debugger or its configuration.
One thing to keep in mind is that tools/dev/gm.py will not overwrite existing build settings. If you e.g. manually put symbol_level = 1 or v8_optimized_debug = true (two examples for settings that will break your debugging experience) into out/x64.debug/args.gn, then gm.py will maintain these settings, assuming that you put them there on purpose. To get back to the defaults, you can rm -rf out/x64.debug. You can also look up the default settings in gm.py's source.
So I tried in a new created file:
python3.sublime-build with the following code
{
"cmd": ["C:\Users\AA\AppData\Local\Programs\Python\Python36-32\python.exe", "$file"],
"selector": "source.python",
"file_regex": "file \"(...*?)\", line ([0-9]+)"
}
And modified the Main.sublime-menu with:
{"command": "repl_open",
"caption": "Python3 - RUN current file",
"id": "repl_python_run",
"mnemonic": "p",
"args": {
"type": "subprocess",
"encoding": "utf8",
"cmd": ["python3", "-u", "$file_basename"],
"cwd": "$file_path",
"syntax": "Packages/Python/Python.tmLanguage",
"external_id": "python",
"extend_env": {"PYTHONIOENCODING": "utf-8"}
}
},
However, when i run the
tools>SubimeREPL>Python>Python3 - RUN current file
from the Sublime Text3 menu bar, i receive a:
"FileNotFoundError(2, 'The system cannot find the file
specified.'None'2)"
Which i have no idea what i am missing.
I want to create a keyboard shortcut in Sublime Text 3.
The command I want to run is something like this:
[make.sublime-build]
{
"name": "boot-dev-svr",
"cmd": ["java","-jar","D:\\prg\\boot\\boot-1.1.1.jar","development"],
"working_dir": "D:/smx",
"path": "C:/Windows/System32",
}
The key I want to map this action to is F5:
[Default (Windows).sublime-keymap - User]
[
{ "keys": ["f5"], "command": "BLAH BLAH BLAH" },
]
Seems like it should be simple, but "cmd" and "command" seem to be fundamentally different. I have not managed to get it to work.
How do I put these things together to do what I want in Sublime Text 3?
Have you tried putting the actual command in []
That worked for me.
Another solution would be to update Sublime Text 3 to the latest release, sometimes that fixes the bug.
Hope I helped!
EDIT
Try removing the comma from the end of make.subime-build, like this
{
"name": "boot-dev-svr",
"cmd": ["java","-jar","D:\\prg\\boot\\boot-1.1.1.jar","development"],
"working_dir": "D:/smx",
"path": "C:/Windows/System32",
}
This is what I wound up doing, which seems to work, more or less.
Build:
{
"cmd": ["python","prj.py","--runmake","serve"],
"working_dir": "D:/smx",
"path": "C:/Python27",
"variants":
[
{
"name": "boot-dev-svr",
"cmd": ["java","-jar","D:\\prg\\boot\\boot-1.1.1.jar","development"],
"working_dir": "D:/smx",
"path": "C:/Windows/System32",
},
]
}
Keymap:
[
{ "keys": ["f5"], "command": "build", "args": {"variant": "boot-dev-svr"} },
]
Or to be more precise, how can i find out which command and which parameters do i need to add in my user .sublime-keymap file to shortcut the Anaconda: Run Project Tests command? Are the commands listed somewhere?
This is the default anaconda .sublime-keymap file:
[
{"command": "anaconda_goto", "keys": ["ctrl+alt+g"]},
{"command": "anaconda_find_usages", "keys": ["ctrl+alt+f"]},
{"command": "anaconda_doc", "keys": ["ctrl+alt+d"]},
{"command": "anaconda_auto_format", "keys": ["ctrl+alt+r"]},
{"command": "anaconda_goto", "keys": ["g", "d"],
"context":
[
{ "key": "selector", "operator": "equal", "operand": "source.python" },
{ "key": "setting.command_mode", "operand": true },
{ "key": "setting.is_widget", "operand": false }
]
}
]
The documentation for the test runner expects me to already know the command i want to shortcut by heart:
note: Of course you can configure whatever shortcut that you want to
run anaconda tests but they are not added by default
See here list all anaconda commands.
Answer you question:
Add this in "Prefences->Key Bindings - User"
{"command": "anaconda_run_project_tests", "keys": ["ctrl+alt+t"]},
While running SublimeREPL: SBT for opened folder, I have the exact same problem as in The similar question asked before (OSError(2, 'No such file or directory')).
Unofrtunately, the solution provided there did not help much.
Would anybody be kind enough to give some clues as to what might still be wrong here?
I'm currently running Ubuntu 12.04.
My Main.sublime-menu config is as follows:
[
{
"id": "tools",
"children":
[{
"caption": "SublimeREPL",
"mnemonic": "r",
"id": "SublimeREPL",
"children":
[
{"caption": "Scala",
"id": "Scala",
"children":[
{"command": "repl_open",
"caption": "scala REPL",
"id": "repl_scala",
"mnemonic": "s",
"args": {
"type": "subprocess",
"encoding": "utf8",
"external_id": "scala",
"cmd": {"linux": ["scala"],
"osx": ["scala"],
"windows": ["scala.bat", "-i"]},
"soft_quit": "\nexit\n",
"cwd": "$file_path",
"cmd_postfix": "\n",
"extend_env": {"osx": {"EMACS": "1", "PATH": "{PATH}:/home/helluin/apps/sbt/bin"},
"linux": {"EMACS": "1", "PATH": "{PATH}:/home/helluin/apps/sbt/bin/"},
"windows": {"EMACS": "1"}},
"suppress_echo": false,
"syntax": "Packages/Scala/Scala.tmLanguage"
}
},
{"command": "repl_open",
"caption": "SBT for opened folder",
"id": "repl_sbt",
"mnemonic": "b",
"args": {
"type": "subprocess",
"encoding": "utf8",
"external_id": "scala",
"cmd": {"linux": ["sbt"],
"osx": ["sbt"],
"windows": ["sbt"]},
"soft_quit": "\nexit\n",
"cwd": "$folder",
"cmd_postfix": "\n",
"extend_env": {"osx": {"EMACS": "1", "PATH": "{PATH}:/usr/bin"},
"linux": {"EMACS": "1", "PATH": "{PATH}:/usr/bin"},
"windows": {"EMACS": "1"}},
"suppress_echo": false,
"syntax": "Packages/Scala/Scala.tmLanguage"
}
}
]}
]
}]
}
]
Also, the scala and sbt system paths are defined thusly
λ → which scala
/usr/bin/scala
λ → which sbt
/home/helluin/apps/sbt/bin/sbt
You have your paths mixed up. The "caption": "scala REPL" menu item has scala as its command, but the extended PATH is /home/helluin/apps/sbt/bin. The "caption": "SBT for opened folder" item has sbt as its command, yet the extended PATH is /usr/bin. You should switch them.
Alternatively, for the Scala REPL, make the first line of the command:
"cmd": {"linux": ["/usr/bin/scala"],
(although /usr/bin should already be in the system PATH). For the sbt REPL, make the first line of the command:
"cmd": {"linux": ["/home/helluin/apps/sbt/bin/sbt"],
and then you don't need to worry about extending that particular environment variable.