Skip to content

Commit

Permalink
feat(initial): add blog project
Browse files Browse the repository at this point in the history
  • Loading branch information
penguineo committed Oct 19, 2024
0 parents commit 556b7f6
Show file tree
Hide file tree
Showing 229 changed files with 52,936 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/hugo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Sample workflow for building and deploying a Hugo site to GitHub Pages
name: Deploy Hugo site to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["master"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

# Default to bash
defaults:
run:
shell: bash

jobs:
# Build job
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.128.0
steps:
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Install Dart Sass
run: sudo snap install dart-sass
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Install Node.js dependencies
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
- name: Build with Hugo
env:
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
HUGO_ENVIRONMENT: production
run: |
hugo \
--minify \
--baseURL "${{ steps.pages.outputs.base_url }}/"
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./public

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
42 changes: 42 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Hugo's default ignore patterns

# OS-specific files
.DS_Store
Thumbs.db

# Node modules and dependencies
node_modules/
package-lock.json
yarn.lock
*.lock

# Build directories and files
public/
resources/
# Note: 'public' is where Hugo generates the static site, and 'resources' is for Hugo’s asset pipeline

# Logs
*.log

# IDE and editor files
.vscode/
.idea/
*.sublime-project
*.sublime-workspace

# System files
*.swp
*.swo

# Other common patterns
*.bak
*.tmp
*.orig
*.out

# Environment files
.env

# Coverage and testing
coverage/
test-results/
9 changes: 9 additions & 0 deletions archetypes/default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
+++
title = '{{ replace .File.ContentBaseName "-" " " | title }}'
description = ""
categories = []
tags = []
date = {{ .Date }}
math = false
draft = true
+++
31 changes: 31 additions & 0 deletions assets/saas/fonts.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@font-face {
font-display: swap;
font-family: 'Georgia';
font-style: normal;
font-weight: bold;
src: url('../fonts/Georgia.ttf');
}

@font-face {
font-display: swap;
font-family: 'Georgia';
font-style: italic;
font-weight: bold;
src: url('../fonts/Georgia.ttf');
}

@font-face {
font-display: swap;
font-family: 'Georgia';
font-style: italic;
font-weight: normal;
src: url('../fonts/Georgia.ttf');
}

@font-face {
font-display: swap;
font-family: 'Georgia';
font-style: normal;
font-weight: normal;
src: url('../fonts/Georgia.ttf');
}
35 changes: 35 additions & 0 deletions content/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
+++
title = 'About Me'
description = "Learn more about the author and the purpose of this blog."
+++

## About Me

Hello! I’m subhamc88, the creator and writer behind this blog.
Welcome to my knowledge base, where I delve into a variety of topics, with a primary focus on technology and my personal interests.

### My Background

I have a solid background in software development and a deep-seated passion for technology.
Over the years, I’ve worked on various projects and continuously explored new trends and innovations in the tech world.

### What You’ll Find Here

This blog serves as a comprehensive resource where you can explore:

- Technology Insights: Stay updated with the latest advancements in technology, software development tips, and in-depth analyses of new tools and trends.
- Hobbies and Interests: Get a glimpse into my personal interests, such as reading books, engaging in various hobbies, and other activities that inspire me. I enjoy sharing my thoughts and recommendations on these topics as well.
- Personal Reflections: Read about my thoughts on various subjects, including life experiences, observations, and insights that may offer value or provoke thought.

This blog is a reflection of my diverse interests and experiences, aiming to provide valuable content and foster a connection with readers who share similar passions.

Thank you for visiting! I hope you find the content here both informative and inspiring. Feel free to explore and connect with me through the links below.

---

**subhamc88**

- Check out my [GitHub Profile](https://www.github.com/subhamc88) for more on my projects and contributions.
- Follow me on [Instagram](https://instagram.com/subhamc_88?igsh=M2Njaml0bDZlbmk2&utm_source=qr) for updates and snapshots of my hobbies and interests.
- Contact me via [Email](mailto:subham020304@gmail.com) for inquiries, collaborations, or just to say hello.
- Subscribe to this blog's [rss feeds](https://subhamc88.github.io/blog/index.xml) for updates on the latest blogs. (Copy this link and add it to your rss feed reader.)
200 changes: 200 additions & 0 deletions content/posts/dev/code-editor/lsp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
+++
title = 'How Does Your Code Editor Knows Your Language Better Than You Could?'
description = 'Explore how your code editor uses features like syntax highlighting, code completion, linting, and debugging to enhance coding efficiency and streamline workflows. These tools boost productivity, letting you focus on problem-solving instead of language details.'
date = 2024-09-30T20:18:38+05:30
draft = false
categories= ['Tech Tutorials', 'Software Development']
tags= ['LSP', 'Coding', 'Snippets','Tools', 'Productivity']
[cover]
+++

Most of you are using code editors like VSCode or IDEs like PyCharm for coding.
You might be aware of some of the features provided by these applications, such as:

- **Code Completion**:
Smart suggestions as you type your code (IntelliSense).

- **Syntax Highlighting**:
Color-coding different elements of your code.

- **Code Formatting**:
Automatically formats your code based on styling standards (e.g., Prettier).

- **Integrated Debugging**:
Allows you to set breakpoints and run through your code, making it easier to identify and fix issues in real time.

- **Linting**:
Automatically detects errors and potential issues in your code, ensuring that you adhere to coding standards and best practices.

- **Code Actions**:
Provides quick fixes and refactoring suggestions for code issues.

- **Code Navigation**:
Quickly jump to function and variable definitions for exploring your code.
Find references to specific symbols (identifiers) in your codebase.

> **How do you think your code editor provides these features?**
> Short answer: **LSP (Language Server Protocol)**.
## What is LSP?

LSP (Language Server Protocol) is a standardized protocol that facilitates communication between development tools (clients) and language servers.
The client represents your code editor or IDE, while the server is responsible for providing language-specific features.
LSP handles functionalities like autocompletion, error checking, and code navigation in a consistent manner.
It is not tied to any particular programming language, enabling multilingual support.
As a universal standard, enhancements to LSP can improve the functionality and behavior of these features across different languages and editors.

## Why It's Important for Code Editors and Modern Development

- **Consistency**:
LSP provides a uniform way for code editors or IDEs to implement language features, making it easier for developers to use different tools without losing functionality.

- **Efficiency**:
LSP separates language-specific features from the editor itself, allowing developers to focus on improving language support without modifying the editor. This leads to faster updates and enhancements.

- **Enhanced Developer Experience**:
LSP enables advanced features like intelligent code completion, on-the-fly error detection, and refactoring tools, significantly improving productivity.

- **Ecosystem Growth**:
LSP fosters an ecosystem where community-developed language servers can easily integrate with popular editors, promoting broader language support and community contributions.

## But How Does LSP Support Multiple Programming Languages?

- **Language Servers**:
For each programming language, a separate language server can be developed.
These servers communicate with the development tools via LSP, providing language-specific features without the need for editor-specific implementations.

- **Standardized Communication**:
LSP defines a set of standard messages and requests, allowing any language server to work with any editor that implements LSP.

- **Modular Architecture**:
Developers can create or use existing language servers for the languages they work with, ensuring that features are available regardless of the programming language.

- **Community Contributions**:
The open nature of LSP encourages developers to create and share language servers, making it easier to support new or niche programming languages.

> Before learning how a code editor interacts with LSP, we need to understand what language servers are.
## What Are Language Servers?

**Language servers** are standalone programs that provide language-specific features to development tools via LSP.
They act as a medium between the code editor and the programming language, enabling enhanced functionality without the editor needing to know the details of the language.

## What Is the Role of Language Servers in Programming?

- **Feature Provider**:
Language servers offer essential programming features such as:

- **Autocompletion**:
Suggesting code completions based on the context.

- **Syntax Checking**:
Identifying errors and warnings in real time as you write code.

- **Code Navigation**:
Allowing users to quickly jump to definitions, references, and symbols.

- **Refactoring Tools**:
Facilitating code transformations like renaming variables or extracting methods.

- **Separation of Concerns**:
By separating language features from the editor, it allows for easier updates and maintenance.
Developers can focus on enhancing language support without modifying the editor itself.

- **Consistent User Experience**:
Language servers ensure that users have a similar experience across different editors by providing a consistent set of features regardless of the tools being used.

- **Community Contributions**:
Many language servers are open-source and community-driven, allowing for rapid development and support of new programming languages or frameworks.

## How does the LSP connect to the language server?

```markdown

+---------------------------+
| User Action in Code |
| Editor (Write Code) |
+------------+--------------+
|
v
+------------+--------------+
| Code Editor |
+------------+--------------+
|
Send request
v
+------------+--------------+
| LSP |
+------------+--------------+
|
Translate request
v
+------------+--------------+
| Language Server |
+------------+--------------+
|
Process request
|
v
+------------+--------------+
| Generate response |
+------------+--------------+
|
Send response
v
+------------+--------------+
| LSP |
+------------+--------------+
|
Translate response
v
+------------+--------------+
| Code Editor |
+------------+--------------+
|
Update UI/Editor
|
v
+---------------------------+
| User sees results in |
| Code Editor (e.g., |
| suggestions, errors) |
+---------------------------+
```

> All the requests and reponses are done using JSON-RPC.
> JSON-RPC (JavaScript Object Notation-Remote Procedure Call
### Language Server Protocol Overview

#### 1. Initialization of Language Server

1. The programming language is detected based on the file type.
2. The Code Editor or IDE initializes the appropriate language server from pre-installed options.
3. An initial request is sent to the language server using JSON-RPC.

#### 2. Request and Response Flow

1. After initialization, various requests are sent to the language server via LSP while coding.
2. Common requests include:
- Code completion
- Diagnostics
- Linting
- Formatting
3. For each request, the language server responds with the necessary JSON-RPC details.

## Conclusion

By embracing LSP, developers can leverage the full potential of their coding environments, streamline their workflows, and boost productivity.
As LSP continues to evolve, it presents an exciting opportunity for developers to explore new integrations and capabilities, further enhancing their coding experience.
Whether you’re a seasoned programmer or just starting, understanding and utilizing LSP can greatly improve your development journey.

## What's next ?

To deepen your understanding of the Language Server Protocol (LSP) and its applications, consider exploring the following resources:

1. [Edulsp-go](../../projects/rpc-python.md) is designed for beginners who want to learn how Language Server Protocols (LSP) are built using Go.
It provides a hands-on approach to understanding the core concepts and implementation details, making it an excellent starting point for anyone interested in creating their own language servers.

I recommend this resource to every reader, regardless of which code editor you use.
It not only walks you through the setup process but also enhances your understanding of how each feature of LSP is configured and utilized.
Loading

0 comments on commit 556b7f6

Please sign in to comment.