Skip to content

Commit

Permalink
Resolved merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanger2000 committed Mar 29, 2023
2 parents 7b6ab8c + cbcdebe commit 7dc7095
Show file tree
Hide file tree
Showing 83 changed files with 1,297 additions and 1,472 deletions.
21 changes: 21 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"es6": true,
"node": true
},
"plugins": ["unused-imports"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
Expand All @@ -12,5 +13,25 @@
"plugin:import/electron",
"plugin:import/typescript"
],
"rules": {
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-var-requires": "off",
"import/no-named-as-default": "off",
"no-constant-condition": "off",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"warn",
{
"vars": "all",
"varsIgnorePattern": "^_",
"args": "after-used",
"argsIgnorePattern": "^_"
}
]
},
"parser": "@typescript-eslint/parser"
}
54 changes: 50 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"homepage": "cursor.so",
"name": "Cursor",
"homepage": "https://cursor.so",
"name": "cursor",
"author": {
"name": "Michael Truell",
"email": "[email protected]"
"name": "Cursor AI, Inc.",
"email": "[email protected]"
},
"productName": "Cursor",
"version": "0.1.9",
"version": "0.1.11",
"description": "Cursor is an AI-first coding environment.",
"main": ".webpack/main",
"scripts": {
Expand Down Expand Up @@ -66,6 +66,7 @@
"electron-winstaller": "^5.1.0",
"eslint": "^8.36.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-unused-imports": "^2.0.0",
"husky": "^8.0.3",
"identity-obj-proxy": "^3.0.0",
"jest": "^29.3.1",
Expand Down
4 changes: 0 additions & 4 deletions src/app/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@ import {
faTimes,
faHistory,
IconDefinition,
faChevronLeft,
faChevronRight,
} from '@fortawesome/free-solid-svg-icons'
import {
faChevronsLeft,
faChevronsRight,
} from '@fortawesome/pro-regular-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { setChatOpen, toggleChatHistory } from '../features/chat/chatSlice'
import { store } from './store'

Expand Down
33 changes: 20 additions & 13 deletions src/appComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
useState,
useCallback,
} from 'react'
import { faClose, faCog } from '@fortawesome/pro-regular-svg-icons'
import { faClose } from '@fortawesome/pro-regular-svg-icons'
import Modal from 'react-modal'

import { useAppSelector, useAppDispatch } from './app/hooks'
Expand All @@ -26,7 +26,6 @@ import {
getFocusedTab,
} from './features/selectors'

import _ from 'lodash'

import { ChatPopup, CommandBar } from './components/markdown'
import { SettingsPopup } from './components/settingsPane'
Expand Down Expand Up @@ -54,7 +53,7 @@ const customStyles = {
height: 'auto',
marginLeft: 'auto',
marginRight: 'auto',
maxWidth: '600px',
maxWidth: '700px',
},
}

Expand All @@ -66,25 +65,25 @@ function ErrorPopup() {
<Modal
isOpen={showError}
onRequestClose={() => {
dispatch(gs.closeError(null))
dispatch(gs.closeError())
}}
style={customStyles}
>
<div className="errorPopup">
<div className="errorPopup__title">
<div className="errorPopup__title_text">
Maximum Capacity
We ran into a problem
</div>
<div
className="errorPopup__title_close"
onClick={() => dispatch(gs.closeError(null))}
onClick={() => dispatch(gs.closeError())}
>
<FontAwesomeIcon icon={faClose} />
</div>
</div>
<div className="errorPopup__body">
We're getting more traffic than we can handle right now.
Please try again later.
Something unexpected happened. Please try again later. If
this continues, please contact [email protected].
<br />
</div>
</div>
Expand All @@ -111,7 +110,7 @@ function RateLimitPopup() {
</div>
<div
className="errorPopup__title_close"
onClick={() => dispatch(gs.closeError(null))}
onClick={() => dispatch(gs.closeError())}
>
<FontAwesomeIcon icon={faClose} />
</div>
Expand Down Expand Up @@ -152,8 +151,16 @@ function NoAuthRateLimitPopup() {
</div>
</div>
<div className="errorPopup__body">
We're getting more traffic than we can handle right
now. To avoid these limits, you can enter your OpenAI API key in Settings.
We're getting more traffic than we can handle right now.
Please try again in one minute. To avoid these limits, you
can optionally upgrade to{' '}
<a
className="pay-link"
onClick={() => dispatch(ts.upgradeCursor(null))}
>
pro
</a>
.
</div>
</div>
</Modal>
Expand Down Expand Up @@ -183,7 +190,7 @@ function SSHPopup() {
<Modal
isOpen={showRemotePopup}
onRequestClose={() => {
dispatch(gs.closeRemotePopup(null))
dispatch(gs.closeRemotePopup())
}}
style={customStyles}
>
Expand All @@ -194,7 +201,7 @@ function SSHPopup() {
</div>
<div
className="remotePopup__title_close"
onClick={() => dispatch(gs.closeRemotePopup(null))}
onClick={() => dispatch(gs.closeRemotePopup())}
>
<FontAwesomeIcon icon={faClose} />
</div>
Expand Down
28 changes: 14 additions & 14 deletions src/components/codemirror-vim/block-cursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Piece {
) {}

draw() {
let elt = document.createElement('div')
const elt = document.createElement('div')
elt.className = this.className
this.adjust(elt)
return elt
Expand Down Expand Up @@ -99,11 +99,11 @@ export class BlockCursorPlugin {
}

readPos(): Measure {
let { state } = this.view
let cursors = []
for (let r of state.selection.ranges) {
let prim = r == state.selection.main
let piece = measureCursor(this.cm, this.view, r, prim)
const { state } = this.view
const cursors = []
for (const r of state.selection.ranges) {
const prim = r == state.selection.main
const piece = measureCursor(this.cm, this.view, r, prim)
if (piece) cursors.push(piece)
}
return { cursors }
Expand All @@ -114,7 +114,7 @@ export class BlockCursorPlugin {
cursors.length != this.cursors.length ||
cursors.some((c, i) => !c.eq(this.cursors[i]))
) {
let oldCursors = this.cursorLayer.children
const oldCursors = this.cursorLayer.children
if (oldCursors.length !== cursors.length) {
this.cursorLayer.textContent = ''
for (const c of cursors) this.cursorLayer.appendChild(c.draw())
Expand Down Expand Up @@ -156,8 +156,8 @@ const themeSpec = {
export const hideNativeSelection = Prec.highest(EditorView.theme(themeSpec))

function getBase(view: EditorView) {
let rect = view.scrollDOM.getBoundingClientRect()
let left =
const rect = view.scrollDOM.getBoundingClientRect()
const left =
view.textDirection == Direction.LTR
? rect.left
: rect.right - view.scrollDOM.clientWidth
Expand All @@ -176,7 +176,7 @@ function measureCursor(
let head = cursor.head
let fatCursor = false
let hCoeff = 1
let vim = cm.state.vim
const vim = cm.state.vim
if (vim && (!vim.insertMode || cm.state.overwrite)) {
fatCursor = true
if (vim.visualBlock && !primary) return null
Expand All @@ -193,9 +193,9 @@ function measureCursor(
head--
letter = view.state.sliceDoc(head, head + 1)
}
let pos = view.coordsAtPos(head, 1)
const pos = view.coordsAtPos(head, 1)
if (!pos) return null
let base = getBase(view)
const base = getBase(view)
let domAtPos = view.domAtPos(head)
let node = domAtPos ? domAtPos.node : view.contentDOM
while (domAtPos && domAtPos.node instanceof HTMLElement) {
Expand All @@ -209,7 +209,7 @@ function measureCursor(
if (!node.parentNode) return null
node = node.parentNode
}
let style = getComputedStyle(node as HTMLElement)
const style = getComputedStyle(node as HTMLElement)
if (!letter || letter == '\n' || letter == '\r') letter = '\xa0'
else if (
/[\uD800-\uDBFF]/.test(letter) &&
Expand All @@ -218,7 +218,7 @@ function measureCursor(
// include the second half of a surrogate pair in cursor
letter += view.state.sliceDoc(head + 1, head + 2)
}
let h = pos.bottom - pos.top
const h = pos.bottom - pos.top
return new Piece(
pos.left - base.left,
pos.top - base.top + h * (1 - hCoeff),
Expand Down
Loading

0 comments on commit 7dc7095

Please sign in to comment.