diff --git a/.all-contributorsrc b/.all-contributorsrc
deleted file mode 100644
index 8717657..0000000
--- a/.all-contributorsrc
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "projectName": "Jest tools",
- "projectOwner": "Raathigesh",
- "repoType": "github",
- "repoHost": "https://github.com",
- "files": [
- "README.md"
- ],
- "imageSize": 100,
- "commit": false,
- "commitConvention": "none",
- "contributors": [
- {
- "login": "Raathigesh",
- "name": "Raathi Kugarajan",
- "avatar_url": "https://avatars.githubusercontent.com/u/3108160?v=4",
- "profile": "https://github.com/Raathigesh",
- "contributions": [
- "code",
- "doc",
- "ideas",
- "infra",
- "maintenance"
- ]
- }
- ],
- "contributorsPerLine": 7
-}
diff --git a/README.md b/README.md
index 1095111..4bf5d06 100644
--- a/README.md
+++ b/README.md
@@ -1,21 +1 @@
Paper
-
-### Contributors
-
-Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
-
-
-
-
-
-
-
-
-
-
-
-This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
diff --git a/src/extension/api/index.ts b/src/extension/api/index.ts
index 67f285c..59f63e0 100644
--- a/src/extension/api/index.ts
+++ b/src/extension/api/index.ts
@@ -108,6 +108,34 @@ export async function startApiServer(
});
});
+ // View specific endpoints
+ app.get('/activeFilePath', (req, res) => {
+ res.json({
+ activeFilePath: vscode.window.activeTextEditor?.document.fileName,
+ });
+ });
+
+ app.get('/getSelection', (req, res) => {
+ if (vscode.window.activeTextEditor?.selection.start) {
+ const selectionRange = new vscode.Range(
+ vscode.window.activeTextEditor?.selection.start,
+ vscode.window.activeTextEditor?.selection.end
+ );
+ const text = vscode.window.activeTextEditor?.document.getText(
+ selectionRange
+ );
+
+ const fullTxt = `${text}|${vscode.window.activeTextEditor?.document.fileName}|${selectionRange.start.line}|${selectionRange.start.character}|${selectionRange.end.line}|${selectionRange.end.character}`;
+ res.json({
+ selection: fullTxt,
+ });
+ }
+
+ res.json({
+ selection: null,
+ });
+ });
+
return new Promise((resolve, reject) => {
app.listen(port, () => {
const url = `http://localhost:${port}`;
diff --git a/src/ui/App.tsx b/src/ui/App.tsx
index 705b24a..65da343 100644
--- a/src/ui/App.tsx
+++ b/src/ui/App.tsx
@@ -82,6 +82,7 @@ function App() {
{
getContent();
}}
diff --git a/src/ui/CreateDoc.tsx b/src/ui/CreateDoc.tsx
index a482cdf..b071c2e 100644
--- a/src/ui/CreateDoc.tsx
+++ b/src/ui/CreateDoc.tsx
@@ -19,10 +19,14 @@ import { ClientDoc } from './types';
const API_URL = `http://localhost:${(window as any).port || '4545'}`;
interface Props {
+ activeDoc: ClientDoc | null;
onActiveDocumentChange: () => void;
}
-export default function CreateDoc({ onActiveDocumentChange }: Props) {
+export default function CreateDoc({
+ activeDoc,
+ onActiveDocumentChange,
+}: Props) {
const [docs, setDocs] = useState([]);
const [docName, setDocName] = useState('');
@@ -46,10 +50,6 @@ export default function CreateDoc({ onActiveDocumentChange }: Props) {
onActiveDocumentChange();
};
- useEffect(() => {
- getDocs();
- }, []);
-
const createDoc = async (name: string) => {
const response = await fetch(`${API_URL}/create`, {
method: 'POST',
@@ -66,7 +66,7 @@ export default function CreateDoc({ onActiveDocumentChange }: Props) {
};
return (
-
+ getDocs()}>