https://sciware.flatironinstitute.org/22_Editors
https://github.com/flatironinstitute/learn-sciware-dev/tree/main/22_Editors
Activities where participants all actively work to foster an environment which encourages participation across experience levels, coding language fluency, technology choices*, and scientific disciplines.
*though sometimes we try to expand your options
- Avoid discussions between a few people on a narrow topic
- Provide time for people who haven't spoken to speak/ask questions
- Provide time for experts to share wisdom and discuss
- Work together to make discussions accessible to novices
- Dedicated Zoom moderator to field questions.
- Please stay muted if not speaking. (Host may mute you.)
- We are recording. Link will be posted to https://sciware.flatironinstitute.org/.
- July 21 (preliminary): Shells, environments, command-lines
- Introduction
- Examples and demos of features
- Help with setting up your own environment
What do you spend time doing (other than thinking about logic)? Translating ideas into code:
- is this the right syntax?
- what was that function called? what are the arguments?
- what is in this variable?
- does it compile? does it run?
- trial-and-error, looking at documentation
- repetitive editing tasks
- saving and switching files
- an interactive environment (tool or program)
- for developing (writing, editing) code
- that integrates other features
- designed to make it easier to write code all in one place
- Most IDEs are, at the core, a text editor
- Fancy "spell checker" (variables, functions, syntax), autocomplete
- Aware of code structure, projects, programming language, libraries
- Integrated tools for running, compiling, testing, debugging, checking, documenting, sharing, ...
- No need to switch to terminal to run/build, web browser to look up documentation, ...
- emacs: old UNIX editor, CTRL-heavy (
C-x C-c
), many optional extensions, fully functional programming environment (1976) - vim: based on vi (vi improved), old UNIX editor, heavy on single-key short cuts ("modal"), many optional extensions with IDE functionality (1991)
- Notepad++: in the tradition of Notepad, open-source Windows editor (2003)
- Sublime Text: proprietary editor with fancy navigation, focused on MacOS (2008)
- PyCharm, Spyder: python-specific IDEs with focus on debugging (2010)
- Visual Studio Code ("vscode"): open-source cross-platform editor from Microsoft (2015)
- not to be confused with MS Visual Studio, an older Windows IDE (1997)
- JupyterLab
- Notebooks..
- Editor
- You'll see examples of a number of features
- Get a sense of what's possible
- No need to follow along on your own, live
- Slides can be used as reference to come back and try later
- Most features exist in many other editors (sometimes with plugins, extensions)
https://github.com/jsoules/vs-code-introduction
Workspaces are a quality of life feature of vscode that let you:
- Save which folders you are using.
- Configure settings that only apply to said folders.
- Set tasks (compiling/running) and debugging configurations.
- Store and restore UI state associated with that workspace (opened files, tab order, ...)
- Enable or disable extensions only for that workspace.
Execute python codes without a terminal!
Press Ctrl+Shift+p and look for "python: Select interpreter"
Press Ctrl+F5 or press the green arrow
After you create the task file just press Ctrl+Shift+B!
{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": "Build .cpp file", //Remember this label!
"command": "/usr/bin/g++", //Compiler
"args": [
"-g",
"${workspaceFolder}/simple_addition.cpp",
"-o",
"${workspaceFolder}/simple_addition.out"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "compiler: /usr/bin/g++"
}
]
}
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "Build .cpp file", //Remember this name!
"command": "make",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
Press F5 for starting the session
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) g++ buld and debug",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/simple_addition.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "Build .cpp file"
}
]
}
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Specific file",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/simple_addition.py",
"console": "integratedTerminal"
}
]
}
- Normal breakpoints: "Breaks" the execution of the code when it is hit.
- Conditional breakpoints:
- Expression condition: The breakpoint will "break" execution whenever the expression evaluates to True
- Hit count: "Breaks" execution only if it has been hit a particular number of times
- Inline breakpoints: Only are hit when the execution reaches a specific line and column.
- Continue/Pause (F5)
- Step Over (F10)
- Step Into (F11)
- Restart (Ctrl+Shift+F5)
- Stop (Shift+F5)
- Things to get you comfortable with editing
settings.json
: - Tips and tricks with some customization examples
- Collected extensions with examples
- Most shortcuts begin with
cmd
,alt
, orctrl
depending on system. - Shortcut for editing your shortcuts:
- (Mac)
cmd + K cmd + S
- (Windows/Linux)
ctrl + K ctrl + S
- (Mac)
- If you find yourself using one task a lot. Find or make a shortcut for it!
- Tip: Don't be clever. Use the combination that first comes to mind.
- Cheatsheets: macOS, Windows, Linux
- Often easier to edit file directly instead of using UI
- Easily copy settings other people recommend
- Transfer settings over to other machines
- Move through open tabs quickly
{
"key": "ctrl+n",
"command": "workbench.action.nextEditor",
},
{
"key": "ctrl+p",
"command": "workbench.action.previousEditor",
},
- Quick file search
{
"key": "cmd+p",
"command": "workbench.action.quickOpen"
},
- Open and edit keybindings and settings
{
"key": "cmd+;",
"command": "workbench.action.openGlobalKeybindings"
},
{
"key": "cmd+.",
"command": "workbench.action.openSettingsJson"
},
- Access with
cmd + k cmd + t
- Plenty of themes in extensions
- Vim, Emacs, Sublime, etc.