Skip to content

Commit 0b6ef2a

Browse files
authored
Merge branch 'master' into feat/csv
2 parents e059081 + 6a8cccb commit 0b6ef2a

14 files changed

Lines changed: 890 additions & 38 deletions

.github/FUNDING.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ updates:
88
- package-ecosystem: "npm" # See documentation for possible values
99
directory: "/" # Location of package manifests
1010
schedule:
11-
interval: "weekly"
11+
interval: "monthly"

.github/workflows/ci.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master, main, develop ]
6+
pull_request:
7+
branches: [ master, main ]
8+
9+
jobs:
10+
test:
11+
name: Test Extension
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '20'
22+
cache: 'npm'
23+
24+
- name: Install dependencies
25+
run: npm ci
26+
27+
- name: Install xvfb and setup display
28+
run: |
29+
sudo apt-get update
30+
sudo apt-get install -y xvfb
31+
export DISPLAY=:99
32+
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
33+
sleep 5
34+
echo "Display setup complete"
35+
36+
- name: Verify display is working
37+
run: |
38+
export DISPLAY=:99
39+
xdpyinfo > /dev/null 2>&1 && echo "Display is working" || echo "Display not working"
40+
41+
- name: Run tests
42+
run: npm test
43+
env:
44+
DISPLAY: ':99'
45+
46+
- name: Check for linting errors
47+
run: npm run lint || echo "No lint script found, skipping lint check"
48+
49+
build:
50+
name: Build Extension
51+
runs-on: ubuntu-latest
52+
needs: test
53+
54+
steps:
55+
- name: Checkout
56+
uses: actions/checkout@v4
57+
58+
- name: Setup Node.js
59+
uses: actions/setup-node@v4
60+
with:
61+
node-version: '20'
62+
cache: 'npm'
63+
64+
- name: Install dependencies
65+
run: npm ci
66+
67+
- name: Build extension
68+
run: |
69+
npm install -g @vscode/vsce
70+
vsce package --out pastum-extension.vsix
71+
72+
- name: Upload extension artifact
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: pastum-extension
76+
path: pastum-extension.vsix
77+
retention-days: 30

.vscode-test.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,15 @@ import { defineConfig } from '@vscode/test-cli';
22

33
export default defineConfig({
44
files: 'test/**/*.test.js',
5+
launchArgs: [
6+
'--disable-gpu',
7+
'--disable-software-rasterizer',
8+
'--disable-dev-shm-usage',
9+
'--no-sandbox',
10+
'--disable-setuid-sandbox',
11+
'--disable-web-security',
12+
'--disable-features=VizDisplayCompositor'
13+
],
14+
extensionDevelopmentPath: '.',
15+
extensionTestsPath: './test'
516
});

README.md

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
1-
<!-- badges: start -->
2-
[![Website](https://img.shields.io/website?url=https%3A%2F%2Fpastum.anatolii.nz)](https://pastum.anatolii.nz/) ![Visual Studio Marketplace Version](https://img.shields.io/visual-studio-marketplace/v/atsyplenkov.pastum?include_prereleases&style=flat&label=stable%20version&color=green&link=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Datsyplenkov.pastum) [![Visual Studio Marketplace Installs](https://img.shields.io/visual-studio-marketplace/i/atsyplenkov.pastum?label=VS%20Marketplace%20installs&color=7abfbb&link=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Datsyplenkov.pastum)](https://marketplace.visualstudio.com/items?itemName=atsyplenkov.pastum) [![Open VSX Downloads](https://img.shields.io/open-vsx/dt/atsyplenkov/pastum?label=Open%20VSX%20downloads&color=c160ef)](https://open-vsx.org/extension/atsyplenkov/pastum) [![Deploy Extension](https://github.com/atsyplenkov/pastum/actions/workflows/publish-extensions.yml/badge.svg)](https://github.com/atsyplenkov/pastum/actions/workflows/publish-extensions.yml) ![GitHub License](https://img.shields.io/github/license/atsyplenkov/pastum?color=blue) [![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
3-
<!-- badges: end -->
4-
# [Pastum: paste as ... dataframe](https://pastum.anatolii.nz)
5-
6-
`pastum` allows you to quickly transform any text/HTML table from your clipboard into a dataframe object in your favorite language — R, Python, Julia or JavaScript. Almost all popular frameworks are supported; if something is missing, don't hesitate to raise an [issue](https://github.com/atsyplenkov/pastum/issues).
1+
# Pastum: paste as ... dataframe
2+
3+
<p align="center">
4+
<a href="https://pastum.anatolii.nz/">
5+
<img src="https://img.shields.io/website?url=https%3A%2F%2Fpastum.anatolii.nz&style=flat&labelColor=1e2c2e&color=007ACC&logo=Visual%20Studio%20Code&logoColor=white"></a>
6+
<a href="https://marketplace.visualstudio.com/items?itemName=atsyplenkov.pastum">
7+
<img src="https://img.shields.io/visual-studio-marketplace/i/atsyplenkov.pastum?style=flat&labelColor=1e2c2e&color=007ACC&logo=Visual%20Studio%20Code&logoColor=white&label=VS%20Marketplace%20installs"></a>
8+
<br>
9+
<a href="https://open-vsx.org/extension/atsyplenkov/pastum">
10+
<img src="https://img.shields.io/open-vsx/dt/atsyplenkov/pastum?style=flat&labelColor=1e2c2e&color=007ACC&logo=Open%20VSX&logoColor=white&label=Open%20VSX%20downloads"></a>
11+
<a href="https://github.com/atsyplenkov/pastum/actions/workflows/ci.yml">
12+
<img src="https://img.shields.io/github/actions/workflow/status/atsyplenkov/pastum/ci.yml?style=flat&labelColor=1e2c2e&color=007ACC&logo=GitHub%20Actions&logoColor=white&label=tests"></a>
13+
<a href="https://github.com/atsyplenkov/pastum/actions/workflows/publish-extensions.yml">
14+
<img src="https://img.shields.io/github/actions/workflow/status/atsyplenkov/pastum/publish-extensions.yml?style=flat&labelColor=1e2c2e&color=007ACC&logo=GitHub%20Actions&logoColor=white&label=deploy"></a>
15+
<br>
16+
<a href="https://github.com/atsyplenkov/pastum/blob/master/LICENSE.md">
17+
<img src="https://img.shields.io/github/license/atsyplenkov/pastum?style=flat&labelColor=1e2c2e&color=007ACC&logo=GitHub&logoColor=white"></a>
18+
</p>
19+
20+
`pastum` allows you to quickly transform any text/HTML table from your clipboard into a dataframe object in your favorite language — R, Python, Julia, JavaScript or Markdown. Almost all popular frameworks are supported; if something is missing, don't hesitate to raise an [issue](https://github.com/atsyplenkov/pastum/issues).
721

822
# Example usage
923

@@ -19,6 +33,12 @@ Or you can specify the `pastum.defaultDataframeR`/`pastum.defaultDataframePython
1933

2034
![](https://github.com/atsyplenkov/pastum/raw/master/assets/demo-r-tibble.gif)
2135

36+
### Text table to Markdown table
37+
38+
You can also paste from the clipboard as Markdown table by choosing the `Table ➔ Markdown`
39+
option in the quick command shortcut or in the right click menu.
40+
41+
2242
# Try it Yourself
2343

2444
In the table below, the most unfortunate and complex situation is presented. It is a mixture of empty cells, strings, integer and float values. Select, copy and try to paste it into the IDE. The `{pastum}` will recognize all types correctly and fill empty cells with corresponding `NA`/`missing`/`None`/`null` values.

extension.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const r = require("./src/paste-r.js");
33
const py = require("./src/paste-python.js");
44
const jl = require("./src/paste-julia.js");
55
const js = require("./src/paste-js.js");
6+
const md = require("./src/paste-markdown.js");
67
const def = require("./src/paste-default.js");
78

89
function activate(context) {
@@ -23,6 +24,10 @@ function activate(context) {
2324
"pastum.JSdataframe",
2425
js.clipboardToJSDataFrame
2526
),
27+
vscode.commands.registerCommand(
28+
"pastum.Markdown",
29+
md.clipboardToMarkdown
30+
),
2631
vscode.commands.registerCommand("pastum.Defaultdataframe", def.pasteDefault)
2732
);
2833
}

package-lock.json

Lines changed: 16 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "pastum",
33
"displayName": "Pastum",
4-
"description": "Convert table from clipboard to R, Python or Julia dataframe",
5-
"version": "0.2.1",
4+
"description": "Convert table from clipboard to R, Python, Julia, JS or Markdown dataframe",
5+
"version": "0.3.0",
66
"publisher": "atsyplenkov",
77
"license": "MIT",
88
"pricing": "Free",
@@ -20,7 +20,7 @@
2020
"email": "atsyplenkov@fastmail.com"
2121
},
2222
"engines": {
23-
"vscode": "^1.66.0"
23+
"vscode": "^1.99.0"
2424
},
2525
"categories": [
2626
"Other",
@@ -57,6 +57,11 @@
5757
"title": "Table ➔ JavaScript Dataframe",
5858
"category": "Pastum"
5959
},
60+
{
61+
"command": "pastum.Markdown",
62+
"title": "Table ➔ Markdown",
63+
"category": "Pastum"
64+
},
6065
{
6166
"command": "pastum.Defaultdataframe",
6267
"title": "Pastum: paste as default dataframe"
@@ -132,6 +137,15 @@
132137
],
133138
"default": "polars 🐻",
134139
"markdownDescription": "Select the default framework for JavaScript dataframes to be pasted using the `pastum.Defaultdataframe` command."
140+
},
141+
"pastum.defaultAligmentMarkdown": {
142+
"type": "string",
143+
"enum": [
144+
"columnar ↔️",
145+
"compact ↩️"
146+
],
147+
"default": "columnar ↔️",
148+
"markdownDescription": "Select the default aligment for Markdown tables to be pasted using the `pastum.Defaultdataframe` command."
135149
}
136150
}
137151
}
@@ -141,9 +155,9 @@
141155
},
142156
"devDependencies": {
143157
"@types/node": "24.x",
144-
"@types/vscode": "^1.101.0",
158+
"@types/vscode": "^1.99.0",
145159
"@vscode/test-cli": "^0.0.11",
146160
"@vscode/test-electron": "^2.5.2",
147-
"typescript": "^5.8.3"
161+
"typescript": "^5.9.2"
148162
}
149-
}
163+
}

src/paste-default.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ const r = require("./paste-r.js");
33
const py = require("./paste-python.js");
44
const jl = require("./paste-julia.js");
55
const js = require("./paste-js.js");
6+
const md = require("./paste-markdown.js");
67

78
function pasteDefault() {
89
// Get the default dataframe framework
910
const config = vscode.workspace.getConfiguration("pastum");
1011
const frameR = config.get("defaultDataframeR");
1112
const framePy = config.get("defaultDataframePython");
1213
const frameJS = config.get("defaultDataframeJavascript");
14+
const frameMD = config.get("defaultAligmentMarkdown");
1315

1416
// Get the active editor language
1517
const editor = vscode.window.activeTextEditor;
@@ -32,6 +34,9 @@ function pasteDefault() {
3234
case "javascript":
3335
js.clipboardToJSDataFrame(frameJS);
3436
break;
37+
case "markdown":
38+
md.clipboardToMarkdown(frameMD);
39+
break;
3540
default:
3641
vscode.window.showErrorMessage("No default framework selected");
3742
}

0 commit comments

Comments
 (0)