Setting up a Clojure development environment with SublimeText4 and VS code and LightTable

Web Technology Digital Transformation Technology Artificial Intelligence Technology Natural Language Processing Technology Semantic Web Technology Deep Learning Technology Online Learning & Reinforcement Learning Technology Chatbot and Q&A Technology User Interface Technology Knowledge Information Processing Technology Reasoning Technology Clojure Programming Navigation of this blog

Setting up a Clojure development environment with SublimeText4 and VS code and LightTable

Describe setting up a development environment in Clojure using Sublimetext4 and VS code respectively.For more information on setting up Clojure and leiningen, LightTable is also available as an editor for Clojure, but since it can be used as-is after downloading, we omit the explanation.please refer to Getting Started with Clojure.

SublimeText 4 (ST4) was released on May 21, 2021, the first major update in two and a half years, and the new version features GPU acceleration for interface rendering, enhanced auto-completion The new version features GPU-accelerated interface rendering, enhanced auto-completion, and more.

The ST4 plug-ins have been mainly used via SublimeRepl or terminus/sendcode as the main Clojure development environment (Python, R, and C also use those frameworks), but now a dedicated plug-in called “Clojure-Sublimed” has been added to the ST4 plug-ins. Sublimed”, a dedicated plug-in is available.

How to use it

  1. Install “Clojure Sublimed” using Package Control. (In the menu, select “Tools” → “Command Pallet” → type install → “Package Control:Install Package” → “Clojure Sublimed” or press “Shift”, “Command”, “P” (on a mac) → Type “install” → “Package Control:Install Package” → “Clojure Sublimed”)
  2. Open the clj/cljc/cljs file (or open a new file with “Command” N, click on the code mode in the lower right corner (default is “Pain text”), select Clojure (Clojurescript), and enter the code.
  3. Run Clojure’s Repl server (at the top of the project file you want to run). (If you are using leiningen, “lein repl” in the terminal)
  4. In sublimeText, “Shift”, “Command”, “P” (on mac) (or “Tools” -> “Command Pallet” in the menu) and type “Clojure Sublimed: Connect” and the address (e.g. 64371) that you made work with the Repl in 3. Enter the address (e.g. 64371) and enter
  5. When “CTRL” and “ENTER” are entered on the line of the code to be evaluated, the result of Repl evaluation is displayed on the right side of the code. (In case of error, an error is displayed. For details, refer to the terminal where repl is running.)

Or, in the aforementioned terminus/sendcode case, first

  1. Install terminus/sendcode using Package Control. (In the menu, select “Tools” → “Command Pallet” → type “install” → “Package Control:Install Package” → install “terminus” and “sendcode” respectively, or select “Shift”, “Command”, “P” ( For mac) → type install → “Package Control:Install Package” → install “terminus” and “sendcode” respectively).
  2. Same as above or open a new file with “Command” N, then “Shift” “Command” “P” (for mac) → Set Sytntax:Clojure to Clojure mode.
  3. Shift”, “Command”, “P” (on a mac) → “treminus: Open Default Shells in Panel” to show the panel of Treminus at the bottom, then “lein repl” to run the repl server, or “View” → “Layout” → “Column2″ from the editor menu to split the screen into left and right. Layout” -> “Column2” to split the screen into left and right, then “Shift”, “Command”, “P” (on a mac) -> “Treminus: Open Default Shell in Tab” to display the terminal on one of the split tabs, and “lein repl” to start the repl Start the server.
  4. Same as above
  5. Same as above

The first case is a screen divided into two parts, the screen is divided into upper and lower parts. In the first case, the screen is divided into two parts: the code is written on the left and checked by the lower repl. In the second case, the screen is divided into left and right, and the code is written on the left side and checked on the right side repl.

To end the terminus mode, press

  1. Shift”, “Command”, “P” (on mac), “Clojure Sublimed: Disonnect” to disconnect from repl.
  2. Exit repl with “ctrl” and “d”.
  3. Shift”, “Command”, “P” (on mac) → Treminus: Close All

The project may be terminated at the

  1. Shift” “Command” “P” (on a mac) → “Clojure Sublimed: Disonnect” to disconnect from repl.
  2. Exit “repl” by “ctrl” “d”.
  3. Shift” “Command” “P” (on mac) → “Treminus: Close All

The project may be terminated at the

Next, we describe how to set up the Clojure environment in VS code.

VS code stands for visual studio code, a free text editor provided by microsoft that currently has the largest market share among programmers. The following is a step-by-step guide to development.

  1. To use Clojure with VS code, first install VS code (install the Japanese language plugin if necessary), then go to View→extensions and input and install calva (or View→extensions→calva).
    Next, specify the folder where you want to create a new project with File→Open Folder, and open a new terminal with terminal→new terminal to open a terminal in that folder.
  2. Once the terminal opens, create a new Clojure project. Example: “lein new calva-test01”.
  3. Enter “cd calva-test01” in the terminal to move to the newly created calva-test01 directory
  4. Next, activate the REPL: To activate the REPL in VS code, click on REPL at the bottom of the editor.
  5. Several options will appear at the top of VS code. start your project and connect
  6. Select “leiningen” to start the REPL
  7. Then press “Ctrl” and “Enter” on the line of the code you want to evaluate in the editor.

コメント

タイトルとURLをコピーしました