Skip to content
This repository was archived by the owner on Jul 7, 2024. It is now read-only.

Commit

Permalink
fixed issue with background not working on android
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonLoir committed Feb 22, 2024
1 parent b4ca28e commit 6f0a60b
Show file tree
Hide file tree
Showing 7 changed files with 1,840 additions and 600 deletions.
5 changes: 1 addition & 4 deletions apps/app/app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ import '../global.css';

export default function Layout() {
return (
<SafeAreaView
style={safeAreaStyle.AndroidSafeArea}
className='bg-[rgb(24,24,24)]'
>
<SafeAreaView style={safeAreaStyle.AndroidSafeArea} className='bg-dark'>
<Slot />
</SafeAreaView>
);
Expand Down
2 changes: 1 addition & 1 deletion apps/app/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Text, View } from 'react-native';
export default function App() {
return (
<View>
<Text className='text-white'>Hello world this is a test dd kk</Text>
<Text className='text-white'>Hello world</Text>
</View>
);
}
6 changes: 5 additions & 1 deletion apps/app/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ module.exports = {
'./components/**/*.{js,jsx,ts,tsx}',
],
theme: {
extend: {},
extend: {
colors: {
dark: 'rgb(24,24,24)',
},
},
},
plugins: [],
};
4 changes: 3 additions & 1 deletion apps/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
},
"dependencies": {
"dotenv": "^16.4.5",
"express": "^4.18.2"
"express": "^4.18.2",
"json-rpc-2.0": "^1.7.0",
"ts-lsp-client": "^1.0.1"
}
}
91 changes: 90 additions & 1 deletion apps/server/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,101 @@
import express, { Express, Request, Response } from 'express';
import dotenv from 'dotenv';
import { spawn } from 'child_process';
import { JSONRPCClient, JSONRPCResponse } from 'json-rpc-2.0';
import { JSONRPCTransform } from 'ts-lsp-client';

let id = 1;
const newId = () => id++;

dotenv.config();

const app: Express = express();
const port = process.env.PORT ?? 3000;

app.get('/', (req: Request, res: Response) => {
app.get('/', async (req: Request, res: Response) => {
const p = spawn('typescript-language-server', ['--stdio'], {
shell: true,
stdio: 'pipe',
});

const stream = JSONRPCTransform.createStream(p.stdout);

const client = new JSONRPCClient<any>((jsonRPCRequest) => {
const jsonRPCRequestStr = JSON.stringify(jsonRPCRequest);
console.log(jsonRPCRequestStr);
p.stdin.write(
`Content-Length: ${jsonRPCRequestStr.length}\r\n\r\n${jsonRPCRequestStr}`
);
}, newId);

stream.on('data', (jsonRPCResponseOrRequest: string) => {
const jsonrpc = JSON.parse(jsonRPCResponseOrRequest);
console.log(jsonrpc);
if (Object.prototype.hasOwnProperty.call(jsonrpc, 'id')) {
const jsonRPCResponse: JSONRPCResponse = jsonrpc as JSONRPCResponse;
if (jsonRPCResponse.id === id - 1) {
client.receive(jsonRPCResponse);
}
}
});

const a = await client.request(
'initialize',
{
processId: process.pid ?? null,
capabilities: {},
clientInfo: {
name: 'lspClientExample',
version: '0.0.9',
},
workspaceFolders: [
{
name: 'workspace',
uri: '/tmp/test',
},
],
rootUri: null,
initializationOptions: {
tsserver: {
logDirectory: '.log',
logVerbosity: 'verbose',
trace: 'verbose',
},
},
},
{}
);

client.notify(
'textDocument/didOpen',
{
textDocument: {
uri: '/tmp/test/index.ts',
languageId: 'typescript',
version: 1,
text: 'console.log("hello world")',
},
},
{}
);

const test = await client.request(
'textDocument/hover',
{
textDocument: {
uri: '/tmp/test/index.ts',
},
position: {
line: 0,
character: 5,
},
},
{}
);

console.log('x', a, test);

p.stdin.write('Hello world !');
res.send('Hello world !');
});

Expand Down
Empty file added apps/server/src/lsp/index.ts
Empty file.
Loading

0 comments on commit 6f0a60b

Please sign in to comment.