Merge branch 'main' of github.com:getcursor/cursor

pull/210/head^2
Michael Truell 2023-03-24 23:44:53 -07:00
commit 41759c4b75
10 changed files with 90 additions and 19 deletions

4
.gitignore vendored
View File

@ -116,4 +116,6 @@ settings.json
resources/** resources/**
lsp/** lsp/**
*.zip *.zip
scripts/** scripts/**
run_todesktop.sh

View File

@ -1,32 +1,54 @@
# Cursor # Cursor
This is the repo for [Cursor](https://www.cursor.so), an editor built for pair programming with AI. [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/getcursor/cursor/blob/main/LICENSE) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)]() [![](https://dcbadge.vercel.app/api/server/PJEgRywgRy?style=flat&compact=true)](https://discord.gg/PJEgRywgRy)
Feel free to file tickets for bugs or feature requests. Upvote 👍 the ones you'd like us to prioritize. **[Cursor](cursor.so) is an editor made for programming with AI.** It's early days, but right now Cursor can help you with a few things...
- **Write**: Generate 10-100 lines of code with an AI that's smarter than Copilot
- **Diff**: Ask the AI to edit a block of code, see only proposed changes
- **Chat**: ChatGPT-style interface that understands your current file
- **And more**: ask to fix lint errors, generate tests/comments on hover, etc.
<p align="center">
<a href="https://cursor.so/">
<img src="https://user-images.githubusercontent.com/4297743/227696390-0c1886c7-0cda-4528-9259-0b2944892d4c.png" width="1000"><br>
</a>
</p>
## Getting Started ## Getting Started
Head over to [our website](https://cursor.so/) to download and try out the editor. Head over to [our website](https://cursor.so/) to download and try out the editor.
## Contributing Feel free to file tickets for bugs or feature requests. Upvote 👍 the ones you'd like us to prioritize.
### Setup ## Roadmap
MacOS/Linux: Long term, our plan is to build Cursor into the world's most productive development environment. Using LLMs, we want to do things like:
- Auto-fix errors as soon as they show up in your terminal
- Embed AI-written documentation into the UI
- "Heal" your repository when you're halfway through a refactor
- Allow you to code by editing a "pseudocode" version of your codebase
If you're excited about working on this future, reach out to hiring@cursor.so
## Development
We welcome PRs :) To get started:
``` ```
git clone git@github.com:getcursor/cursor.git
cd cursor
npm i npm i
./setup.sh
``` ```
Windows: Then, download some non-versioned dependencies (ripgrep binaries and language server js):
``` ```
npm i ./setup.sh # Mac/Linux
./setup.ps1 ./setup.ps1 # Windows
``` ```
### Run Finally, to run the client:
``` ```
npm start npm start

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "Cursor", "name": "Cursor",
"version": "0.1.4", "version": "0.1.6",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "Cursor", "name": "Cursor",
"version": "0.1.4", "version": "0.1.6",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@codemirror/commands": "^6.2.1", "@codemirror/commands": "^6.2.1",

View File

@ -6,7 +6,7 @@
"email": "mntruell@gmail.com" "email": "mntruell@gmail.com"
}, },
"productName": "Cursor", "productName": "Cursor",
"version": "0.1.4", "version": "0.1.6",
"description": "Cursor is an AI-first coding environment.", "description": "Cursor is an AI-first coding environment.",
"main": ".webpack/main", "main": ".webpack/main",
"scripts": { "scripts": {

View File

@ -507,5 +507,16 @@ export function useExtensions({
} }
}, [fileIndentUnit, editorRef.current, justCreated]) }, [fileIndentUnit, editorRef.current, justCreated])
useEffect(() => {
if (settings.tabSize != undefined) {
editorRef.current.view?.dispatch({
effects: indentCompartment.reconfigure([
indentUnit.of(" ".repeat(Number(settings.tabSize))),
EditorState.tabSize.of(Number(settings.tabSize))
]),
})
}
}, [settings.tabSize, editorRef.current, justCreated])
return globalExtensions return globalExtensions
} }

View File

@ -115,6 +115,26 @@ export function SettingsPopup() {
/> />
</div> </div>
<div className="settings__item">
<div className="settings__item_title">
Tab Size
</div>
<div className="settings__item_description">
Controls the tab size
</div>
<Dropdown
options={['2', '4', '8']}
onChange={(e) => {
dispatch(
changeSettings({
tabSize: e.value,
})
)
}}
value={settings.tabSize}
/>
</div>
<div className="settings__item"> <div className="settings__item">
<div className="settings__item_title"> <div className="settings__item_title">
Text Wrapping Text Wrapping

View File

@ -300,6 +300,7 @@ export interface Settings {
useFour: string useFour: string
contextType: string contextType: string
textWrapping: string textWrapping: string
tabSize?: string
} }
export interface SettingsState { export interface SettingsState {
@ -400,6 +401,7 @@ export const initialSettingsState = {
useFour: 'disabled', useFour: 'disabled',
contextType: 'none', contextType: 'none',
textWrapping: 'disabled', textWrapping: 'disabled',
tabSize: undefined
}, },
} }

View File

@ -128,6 +128,10 @@ body {
min-width: 140ch; min-width: 140ch;
} }
.display_text_wrapping {
width: 100%;
}
.display_text_wrapping .cm_content { .display_text_wrapping .cm_content {
min-width: 100%; min-width: 100%;
} }
@ -542,6 +546,10 @@ li.rta__item--selected mark {
overflow-y: auto; overflow-y: auto;
} }
.cover-bar {
pointer-events: none;
}
.window__editorcontainer .cover-bar { .window__editorcontainer .cover-bar {
background-color: var(--background); background-color: var(--background);
right: 0px; right: 0px;

View File

@ -34,6 +34,10 @@ const lspDir = app.isPackaged
? path.join(process.resourcesPath, 'lsp') ? path.join(process.resourcesPath, 'lsp')
: path.join(__dirname, '..', '..', 'lsp') : path.join(__dirname, '..', '..', 'lsp')
if (!fs.existsSync(lspDir)) {
fs.mkdirSync(lspDir)
}
// Get the architecture and osType from electron // Get the architecture and osType from electron
// architecture can take the values of 'arm', 'arm64', 'ia32', or 'x64' // architecture can take the values of 'arm', 'arm64', 'ia32', or 'x64'
const architecture = process.arch const architecture = process.arch
@ -419,7 +423,7 @@ class LSPManager {
case 'c': case 'c':
let cVersion = await getLatestVersion( let cVersion = await getLatestVersion(
'https://api.github.com/clangd/clangd/releases/latest' 'https://api.github.com/repos/clangd/clangd/releases/latest'
) )
if (osType === 'Darwin') { if (osType === 'Darwin') {
remoteUrl = `https://github.com/clangd/clangd/releases/download/${cVersion}/clangd-mac-${cVersion}.zip` remoteUrl = `https://github.com/clangd/clangd/releases/download/${cVersion}/clangd-mac-${cVersion}.zip`
@ -434,7 +438,6 @@ class LSPManager {
if (!fs.existsSync(cDir)) { if (!fs.existsSync(cDir)) {
fs.mkdirSync(cDir) fs.mkdirSync(cDir)
} }
// fetch and download it // fetch and download it
downloadPath = path.join(lspDir, 'c', 'clangd.zip') downloadPath = path.join(lspDir, 'c', 'clangd.zip')
await downloadFile(remoteUrl, downloadPath) await downloadFile(remoteUrl, downloadPath)

View File

@ -108,6 +108,7 @@ process.on('unhandledRejection', (error) => {
}) })
const createWindow = () => { const createWindow = () => {
const width = 1500, height = 800;
// Create the browser window. // Create the browser window.
const main_window = new BrowserWindow({ const main_window = new BrowserWindow({
...(process.platform === 'darwin' ...(process.platform === 'darwin'
@ -117,8 +118,10 @@ const createWindow = () => {
trafficLightPosition: { x: 10, y: 10 }, trafficLightPosition: { x: 10, y: 10 },
} }
: { frame: false }), : { frame: false }),
width: 1500, width: width,
height: 800, height: height,
minWidth: width / 2
minHeight: height / 2,
title: 'Cursor', title: 'Cursor',
webPreferences: { webPreferences: {
// @ts-ignore // @ts-ignore