The story of trying Sourcetrail × macOS × VS Code

Introduction

Since the code visualization tool called Sourcetrail has become open source, I will try it immediately. It looks interesting.

What is Source trail

@ IT's article (Code visualization tool "Sourcetrail" for C ++ and Python is open source)

Sourcetrail combines features such as interactive dependency graphs, concise code views, and efficient code search to provide source code overview and detailed information.

By statically analyzing and visualizing the source code, developers are freed from reading a huge amount of existing source code. Sourcetrail supports C, C ++, Java, Python, etc., and seems to be able to connect with editors and IDEs such as Atom, Eclipse and VS Code.

I tried Sourcetrail × macOS × VS Code

0. Premise

Try to set up in the following environment.

1. Sourcetrail installation and project creation

--You can download it from here (https://github.com/CoatiSoftware/Sourcetrail/releases). This time, select "Sourcetrail_2019_4_61_macOS_64bit.zip". --Unzip the downloaded zip, copy Sourcetrail.app inside to the application folder, and you're done.

I will start it immediately.

image-20191126053630817.png

--Creating a project

You can create a new project with Command + N.

image-20191126053821254.png

item Input value
Sourcetail Project Name Enter any project name.
Sourcetail Project Location Specify the save destination of the Sourcetail project file.

--Selecting Source Group

If you click "Add Source Group" in General, the following window will be displayed.

image-20191126054341598.png

Python has only "Empty Python Source Group", so select this and click the "Next" button.

image-20191126054407242.png

--Source Group settings

When you click the "Next" button in the New Source Group, the following setting window will be displayed.

image-20191126054616342.png

item Input value
Python Environment Enter the full Python path.
Files & Directories to index Specify the full path of the directory for source code analysis this time.
Excluded Files & Directory You can probably specify an excluded folder. (I haven't tried it, so I don't know the details ...)
Source File Extensions I'm not sure, so I'm through.

When you click the "Next" button in the Source Group settings window, the following window will be displayed. Click "Create" to complete the project creation.

image-20191126060130409.png

The following display will appear, so click "Start".

image-20191126060310484.png

... This time, I tried it and it was only one file, so it ended in an instant. Click "Quit" to see the result.

image-20191126060420978.png

(Although it is a lonely display) It seems that it was successful for the time being.

image-20191126060637205.png

2. Settings on the VS Code side

Now that the Sourcetail setup has been successful for the time being, the next step is to configure the VS Code side.

--Installation of extension

Search for "source trail" in Extensions and install the extension.

image-20191126061258484.png

--Change settings

Open the settings with command +,, search for "sourcetrail", and set "Sourcetrail: Start Server At Startup" to True.

image-20191126061846509.png

Official documentation (https://www.sourcetrail.com/documentation/)

The communication between Sourcetrail and the code editor is achieved using a local TCP connection. Sourcetrail uses the port 6667 to listen for incoming messages. Outgoing messages will be sent to the port 6666.

3. Sourcetrail ⇄ VS Code connection check

Both Sourcetrail and VS Code will be closed once and restarted.

The connection is complete when the following display appears at the bottom right of each. Thank you for your hard work.

image-20191126062350486.png

App display
Sourcetrail Connected to VS Code
VSCode ☑︎Sourcetrail

Source trail → VS Code is Command + left Click, VS Code → Source trail is right Click → "Source trail: Send Location" to connect to each.

Conclusion

Very convenient. (Small feeling) This time we introduced the setup on macOS, but we were able to install it smoothly on Windows 10.

reference

-@ IT's article (Code visualization tool "Sourcetrail" for C ++ and Python is open source )

-Official documentation (https://www.sourcetrail.com/documentation/)

Recommended Posts

The story of trying Sourcetrail × macOS × VS Code
The story of trying to reconnect the client
The story of sys.path.append ()
The story of building Zabbix 4.4
[Apache] The story of prefork
Story of trying competitive programming 2
Settings to debug the contents of the library with VS Code
The story of Python and the story of NaN
The story of participating in AtCoder
The story of the "hole" in the file
Story of trying competitive programming Part 1
The story of remounting the application server
The story of writing a program
The story of an error in PyOCR
The story of verifying the open data of COVID-19
The story of adding MeCab to ubuntu 16.04
The story of making Python an exe
The unfortunate world of case-insensitive wildcards (macOS)
[Python3] Rewrite the code object of the function
Edit the file of the SSH connection destination server on the server with VS Code
The story of manipulating python global variables
The story of deciphering Keras' LSTM model.predict
[Python] Get the character code of the file
The story of blackjack A processing (python)
The story of pep8 changing to pycodestyle
The story of trying to push SSH_AUTH_SOCK obsolete on screen with LD_PRELOAD
How to make VS Code aware of the venv environment and its benefits
A story of a high school graduate technician trying to predict the survival of the Titanic
[Python] Read the source code of Bottle Part 2
The story of doing deep learning with TPU
The story of low learning costs for Python
I tried Flask with Remote-Containers of VS Code
The story of making the Mel Icon Generator version2
[Python] Read the source code of Bottle Part 1
Image processing? The story of starting Python for
The story of making a lie news generator
The story of finding the optimal n in N fist
Story of trying to use tensorboard with pytorch
The story of misreading the swap line of the top command
The story of reading HSPICE data in Python
The story of viewing media files in Django
Code for checking the operation of Python Matplotlib
Convert the character code of the file with Python3
The story of making a mel icon generator
[Small story] Download the image of Ghibli immediately
The story of moving from Pipenv to Poetry
VS Code settings
The story of trying to contribute to COVID-19 analysis with AWS free tier and failing
The story of porting code from C to Go and getting hooked (and to the language spec)
A story about trying to introduce Linter in the middle of a Python (Flask) project
The story of launching a Minecraft server from Discord
A story that reduces the effort of operation / maintenance
The story of Python without increment and decrement operators.
The story of stopping the production service with the hostname command
The story of replacing Nvidia GTX 1650 with Linux Mint 20.1.
The story of building the fastest Linux environment in the world
The story of Hash Sum mismatch caused by gcrypto20
Try touching the micro: bit with VS Code + Python
The story of sharing the pyenv environment with multiple users
A story of trying out pyenv, virtualenv and virtualenvwrapper
Let's break down the basics of TensorFlow Python code