[HN Gopher] GitHub Copilot available for JetBrains and Neovim
___________________________________________________________________
GitHub Copilot available for JetBrains and Neovim
Author : orph
Score : 375 points
Date : 2021-10-27 17:42 UTC (5 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| soledades wrote:
| So it looks like for neovim there is not yet the option to cycle
| through suggestions?
|
| Looks like for VSCode the shortcut on Linux is Alt-], see:
| https://github.com/github/copilot-docs/blob/main/docs/visual...
|
| But for neovim, it doesn't mention anything about it in the docs:
| https://github.com/github/copilot.vim/blob/release/doc/copil...
|
| And, nothing happens when pressing Alt-].
| alexellisuk wrote:
| So who knows what all that WASM is for in the Neovim plugin? Is
| there source for it?
| https://github.com/github/copilot.vim/tree/release/copilot/d...
| wilde wrote:
| A web search suggests that it's this: https://github.com/nvim-
| treesitter/nvim-treesitter
| kevincox wrote:
| Presumably they are tree-sitter grammars for those languages. I
| think these grammars are open source so should be available
| (assuming they were unmodified).
| qanstr wrote:
| We should put up a huge amount of Oracle open source code on
| GitHub, get CoPlagiarizer to quote it and let Oracle deal with
| the situation.
|
| The plebs should also play a little divide and conquer now and
| then.
| mewse wrote:
| I've never understood the value proposition for Copilot.
|
| In terms of difficulty, writing code is maybe on average a two
| out of ten.
|
| On average, maintaining code you wrote recently is probably a
| three out of ten in terms of difficulty, and maintaining code
| somebody else wrote or code from a long time ago probably rises
| to around a five out of ten.
|
| Debugging misbehaving code is probably a seven out of ten or
| higher.
|
| GitHub Copilot is optimising the part of the process that was
| already the easiest, and makes the other parts harder because it
| moves you from the "I wrote this" path to the "somebody else
| wrote this" path.
|
| Even during the initial write, it changes the writing process
| from programming (which is easy) to understanding somebody else's
| code to ensure that it's right before accepting the suggestion
| (which is much less easy). I just don't understand how this is a
| net time/energy savings?
| MayeulC wrote:
| Does it relies on a Microsoft-provided API? If it's not offline,
| the same gotchas as other SaaS apply.
| marstall wrote:
| Any1 get it working WebStorm yet?
| wara23arish wrote:
| I have a few questions about copilot. I haven't gotten a chance
| to use it yet.
|
| Is it irrational that this makes me a little anxious about job
| security over the longterm? Idk why but this was my initial
| reaction when learning about this.
|
| Given the scenario where copilot and its likes becomes used in a
| widespread manner. Can it be argued that this might improve
| productivity but stifle innovation?
|
| Im pretty early in my career but the rate things are capable of
| changing soon doesn't sit too well with me.
| api wrote:
| I wouldn't worry about job security. Programming is a story of
| steady gradual automation and all that's done is increased its
| reach and multiplied the number of niches where there is demand
| for software.
|
| Future developers might be more like architects guiding AIs and
| then occasionally jumping in to hand-hold or correct the
| result.
| abecedarius wrote:
| It's reasonable to worry.
|
| - Copilot is qualitatively different from the kinds of
| automation of programming we've seen before.
|
| - It's barely version 1.0 of this kind of thing. Deep learning
| has been advancing incredibly for a decade and doesn't seem to
| be slowing down. Researchers also work on things like
| mathematical problem-solving, which would tie in to "real work"
| and not just the boilerplate.
|
| - In past examples of AI going from subhuman to superhuman,
| e.g. chess and go, the practitioners did not expect to be
| overtaken just a few years after it had not even felt like real
| competition. You'd read quotes from them about the ineffability
| of human thought.
|
| What to do personally, I don't know. Stay flexible?
| ericbarrett wrote:
| > Is it irrational that this makes me a little anxious about
| job security over the longterm? Idk why but this was my initial
| reaction when learning about this.
|
| I've been programming since the '80s. It's my opinion that the
| age of humans writing code is coming to a close. Perhaps
| another 20 years or so, with the peak in ~10; but I'm less
| certain about the timeline than the destination. There will
| still be a long tail, but most of the human work will shift to
| design and wrangling algorithms. The remnant will be hobbyist,
| such as Commodore 64 programmers today.
| fungiblecog wrote:
| You should only be worried if you just copy and paste
| boilerplate between files. If you're actually able to solve
| problems and design things there's nothing to be worried about
| d13 wrote:
| It's nothing more than an enhanced autocomplete that's 1 part
| dangerous and two parts hillarious. You'll have your job for
| life.
| objclxt wrote:
| > Is it irrational that this makes me a little anxious about
| job security over the longterm?
|
| In the 50s, we programmed computers with punch cards. Who does
| now? How many web developers today could tell the difference
| between `malloc` and `calloc`? Probably not that many.
|
| For a lot of developers, programming today bears very little
| relation to programming decades ago. Copilot is like any other
| innovation - it obsoletes some skills, and it introduces new
| ones.
|
| I doubt copilot will _reduce_ the need for engineers: but it
| may change the work they do. But that 's no different to any
| other industry.
| eloisius wrote:
| I don't like this narrative. Going from punch cards, to
| Assembly, to C and to dynamic languages all empowered the
| programmer with more expressive languages. I don't believe
| going from Python to programming via code comments is the
| same deal.
|
| It would be more like we still write asm but we have editors
| that let you write a little C code and then it spits out a
| paragraph of 'reasonable' asm that still has to be
| maintained.
| tikhonj wrote:
| That's roughly how I've seen experienced people work on
| high-performance code. I mean, they rarely maintain the
| generated assembly _directly_ , but they _do_ write code
| with the assembly it would generate in mind, and keeping
| the code generating comparable assembly over time is part
| of maintaining the performance-critical parts of the
| codebase.
| ipnon wrote:
| Can any users give their opinion on how it's helping their
| productivity? What problems are they finding, if any?
| ridiculous_fish wrote:
| There's a risk of it turning into a worse StackOverflow, by
| suggesting plausible-looking but subtly incorrect code. Here's
| two examples I found:
|
| https://twitter.com/ridiculous_fish/status/14527512360594513...
| kall wrote:
| If I have an if else case, a switch statement or something
| similar, it can often predict the next branch exactly how I
| would write it. That's probably 80% of the suggestions I
| accept, the rest is single line autocompletes. I have never
| accepted a whole function implementation, and they are actually
| rather annoying because they make the document jump.
|
| It's useful enough for me, as a magic autocomplete.
| etaioinshrdlu wrote:
| I only played around with it on OpenAI but it's the same model
| as far as I know. It's pretty good at regurgitating algorithms
| it's seen before. It's not good at all at coming up with new
| algorithms.
|
| It's very good at translating between programming languages,
| including pseudocode.
|
| It can write a lot more valid code much quicker than any human,
| and in a whole slew of languages.
|
| I haven't had the urge to use it much after playing around with
| it constantly for a few days, but it was pretty mind-blowing.
| yepthatsreality wrote:
| Your response makes me wonder if poisoning the well is
| possible by submitting code to Github with multiple languages
| and coding styles. A single file with a function signature
| written in Javascript and the body written in Python + Ruby.
| Enough code would surely break the AI model behind it. Unless
| Copilot has some sort of ingestion validation which wouldn't
| surprise.
| ctoth wrote:
| I don't know if this is true, but I would assume that the
| tokenizers they used for Codex use actual language parsers
| which would drop invalid files like this and make this
| attack infeasible.
|
| When I was playing around a couple years ago with the
| Fastai courses in language modeling I used the Python
| tokenize module to feed my model, and with excellent parser
| libraries like Lark[0] out there it wouldn't take that long
| to build real quality parsers.
|
| Of course I could be totally wrong and they might just be
| dumping pure text in, shutter.
|
| [0]: https://github.com/lark-parser/lark
| Grimm1 wrote:
| In any training with code I've done, we've written a parser
| that validates against tree sitter grammars to make sure
| it's at least syntactically valid against some known subset
| of languages we're training on.
| yepthatsreality wrote:
| I'm which case shifting strategies toward code that looks
| correct but isn't using shared syntax between languages
| as well as language specific gotchas.
| Grimm1 wrote:
| Yeah but if malicious intent is a concern you can just
| spin up a sandboxed instance to run the code to check
| first.
|
| Really the thing is there's not way to ascribe
| correctness to a piece of code right, like humans fail at
| this even. The only "correct" code is like rote
| algorithmic code that has a well defined method of
| operation. And there's likely a lot more correct examples
| of that, like way more than you'd ever be able to poison.
|
| You may be able to be misleading though by using names
| that say one thing but do another, but again you'd be
| fighting against the tide of correctly named things.
| stu2b50 wrote:
| Probably but you would have to submit an absurdly large
| amount of code to make a dent. Practically unreasonable
| considering their training corpus is also increasing per
| lines of public code submitted on github.
|
| So not only would you have to submit a insanely large
| amount of code but you're also racing against literally
| millions of users writing legitimate code at any period of
| time.
| yepthatsreality wrote:
| Why not just use AI to generate the code, and automate
| submission via APIs?
| [deleted]
| josefx wrote:
| > Probably but you would have to submit an absurdly large
| amount of code to make a dent.
|
| So how about an already poisoned well. How up to date is
| the average Github project on encryption standards?
| the42thdoctor wrote:
| I was working on some internationalization stuff, translating
| some phrases from english to portuguese and Copilot just did it
| for me, does not seem like much but for me that is amazing.
|
| I was able to write {"Settings":...} and Copilot completed with
| {"Settings": "Configuracoes"} that tool is simply amazing.
| dreyfan wrote:
| It's a dream come true for the script kiddies.
| rawtxapp wrote:
| It's truly amazing, almost felt magical the first few
| autocomplete results I got.
|
| There's the benefits that a lot of people mentioned, but to me
| the biggest benefit is I can avoid procrastination. Usually
| when I'm blocked on something I'll run a search in the browser,
| but very quickly I end up going off the trail and just browsing
| the web and losing a lot of time. Now when I'm blocked I simply
| type the comment of what I'm trying to do and the autocomplete
| suggestion is pretty damn good and unblocks me very quickly.
| More surprising of all, it somehow understands my code style by
| looking at the context.
| karmasimida wrote:
| Useful to say, write a python script, doing some mandane
| things, like generate all the argparse lines for you, read the
| files, etc.
|
| In a way, it does the dirty pipes surprisingly well. But when
| it comes to implement the core of the algorithm, it is not
| there yet, but the potential is huge.
| ed_elliott_asc wrote:
| It is massively improving my productivity, things I couldn't be
| bothered to write it does for me.
|
| The thing I find really good is it can predict what I will do
| next. Say if I have a list of columns in some text somewhere in
| the project when I write one "df =
| df.withColumn("OneItemInList")"
|
| Copilot will then add the same for all the other items - is
| really nice
| dgunay wrote:
| It can generate the body of test cases well, especially in BDD
| frameworks where you write the high-level scenario first to
| prime it with context. Less tedium encourages me to write more
| tests.
|
| More verbose languages like C++ become less obnoxious to write
| in. I know RSI has been mentioned and any tool which cuts down
| on excessive typing will help with that.
|
| It sometimes reveals bits of the standard library I wasn't
| aware of in unfamiliar languages. I can write my intent as a
| comment and then it may pull out a one-liner to replace what I
| would have normally done using a for loop.
|
| The main downside I've observed is that if I'm not trying to
| reign it in, it can result in a lot of WET code since it can
| pattern match other areas of the surrounding code but can't
| actually rewrite anything that has already been written. It is
| important to go back and refactor the stuff it produces to
| avoid this.
| abidlabs wrote:
| What I like most about Copilot is seeing different programming
| styles suggested to me
|
| For example, I didn't know about self.fail() in unittests and
| had never used it, but Copilot suggested it and it produced the
| most readable version of the unit test
| baby wrote:
| As other pointed out, it makes boring or repetitive tasks a
| breeze.
|
| Also, it's like a more clever auto complete most of the time,
| even when it's wrong in calling a function you can use it as
| foundation code to go faster.
|
| And you don't need to think too much about it, it really keeps
| you in the flow.
| trothamel wrote:
| I find it works well when my intent is clear. For example, I
| might want to log a value I just computed for debugging
| purposes. I type LOG, wait a second, and it completes a zephyr
| logging macro, complete with a sensible message and the value I
| just computed.
|
| It sort of feels like pair programming with an undergraduate,
| except copilot never learns. That isn't to say it's bad, more
| that it is just a tool you can hand simple stuff off to, except
| the handoff is zero-effort.
|
| EDIT: I will say that there are times when it makes up fantasy
| constants or variable names, that seem plausible but don't
| exist. An eventual version of Copilot that includes more normal
| autocompletion information, so it only suggests symbols that
| exist, will be a stronger tool.
| JoshCole wrote:
| I've actually found it helpful as an API autocomplete, but...
| also not helpful at the same time.
|
| So for example I was working with processing an image to
| extract features and a few variants of docstrings for the
| method got me a pretty close to working function which
| converted the image to gray scale, detected edges, and computed
| the result I wanted.
|
| The helpful thing here was that there were certain APIs that
| were useful as a part of doing this that it knew but which I
| would have to do look up. I had to go through and modify the
| proposed solution: it got the conditional in the right place,
| but I wanted a broader classification so switched from a (255,
| 255, 255) check to a nearBlack(pixel) function which it then
| autocompleted successfully. I also had to modify the cropping.
|
| When doing a similar task in the past I spent a lot more time
| on it, because I went down a route in which I was doing color
| classification based on the k nearest neighbors. Later I found
| that the AI I was working on was learning to exploit the
| opacity of the section of the screen I was extracting a feature
| from in order to maximize its reward, because it kept finding
| edge cases in the color classifier. I ended up switching to a
| different color space to make color difference distance
| functions more meaningful, but it wasn't good enough to beat
| the RL agent that was trying to exploit mistakes in the
| classifier.
|
| Anyway, what I'm getting at here is that it is pretty easy to
| spend a lot of time doing similar things to what I'm doing and
| not get a great solution at the end. In this case though it
| only took a few minutes to get a working solution. CoPilot
| didn't code the solution for me, but it helped me get the
| coding done faster because it knew the APIs and the basic
| structure of what I needed to do. To be clear, its solutions
| were all broken in a ton of ways, but it didn't matter it still
| saved me time.
|
| To give another example let's say you have a keyboard key event
| press and you weren't sure about how to translate that into the
| key that was pressed. key.char? key.key? str(key)? key.symbol?
| A former method of figuring out what the right key might be is
| looking up the code, but with CoPilot you type '# Get the key
| associated with the key press' then hit tab and it gives you
| code that is broken but looks perfect and you gain a false
| sense of confidence that you actually know the API. You later
| realize after being amazed that it knew the API so well that
| you didn't have to look it up that actually the key press event
| handles symbols differently and so it errors on anything that
| is used as a modifier key.
|
| My general impression is something like: Wow, this is amazing.
| It understood exactly what I wanted and it knew the APIs and
| coded up the solution... Wait, no. Hold on a second. This and
| that are wrong.
| karmasimida wrote:
| Right
|
| I am in the same boat with you. I am simultaneously wowed and
| underwhelmed to some degree.
|
| Yes it is amazing when it gets right, it feels like cheating.
| But at the same time, it many times, does ... too much? To
| read a huge chuck of code and figuring out where it goes
| wrong is not a thing for me. Also Copilot doesn't really know
| the API, so yes, the amount of mental tax isn't less to make
| sure your program really behaves.
|
| But again, I see the idea of Copilot is already huge win. I
| hate writing those manual scripts just offer people an
| entrance to some utility behind. Copilot does those things,
| surprisingly well and with accuracy.
|
| Let it improve in the future, and we will see changes that
| quite fundamental to the idea of programming itself.
| capableweb wrote:
| Tried it out for a while, and it's clear that it's trying to
| get people to be faster at writing boilerplate, not get people
| to write better code.
|
| I'm a bit scared for what this means as I don't think being
| able to faster write boilerplate is something worthwhile. The
| example ed_elliott_asc made is one of those examples where
| instead of fixing things so you don't have to repeat yourself,
| copilot makes it easy to just live with the boilerplate
| instead.
| csee wrote:
| It's going to be great for exploratory data science. You
| don't really need stellar, maintainable or extensible code
| for that, the early stage is largely about iteration speed.
| manquer wrote:
| Iteration speed also depends on code being well written and
| performance code, you need to get results faster to iterate
| faster.
|
| Also if your don't fully understand your code( when
| generated or copied from SO) as not uncommon with junior
| developers and data science practitioners, then they
| struggle to make even small change for the next iteration,
| because they don't fully understand what their code is
| doing and how.
|
| When your code is composable or modifiable easily then
| iterations become faster because you understand what you
| have written. One of the reasons why analysts prefer Excel
| if data size is within limits.
| aranchelk wrote:
| Boilerplate is exclusively what I use AI-powered code
| completion for (currently Tabnine).
|
| In a perfect world we'd all have excellent comprehensive
| metaprogramming facilities in our programming languages and
| no incidence of RSI (e.g. carpal tunnel syndrome). Code
| completion is a good tool to deal with these realities.
| airstrike wrote:
| _> I don 't think being able to faster write boilerplate is
| something worthwhile_
|
| But do you believe people being _slower_ at writing
| boilerplate is undesirable?
| kyleee wrote:
| It may be desirable for boilerplate to be maximally painful
| if it forces our collective hands to cut down on
| boilerplate and innovate it away
| kevingadd wrote:
| Who is realistically going to innovate the boilerplate
| out of Java if they're stuck using it at work?
| stelcodes wrote:
| I mean, Clojure kinda does that
| kevingadd wrote:
| So the solution to the problems that Copilot tries to
| solve is "migrate your workplace to Clojure"? Ordinary
| devs can't do that.
| gridspy wrote:
| That, or any job where you're not permitted to make the
| sweeping changes required to resolve boilerplate. Many of
| my jobs had such restrictions.
| closeparen wrote:
| That's a good plan if your language isn't Go. For us I
| think tools to wrangle boilerplate are a lot more
| feasible than actually eliminating it.
| zomglings wrote:
| if commentErr != nil { hn.Upvote("https://new
| s.ycombinator.com/item?id=29017491") }
| verve_rat wrote:
| In my experience whenever someone tries to "innovate"
| away boilerplate they end up creating shitty abstractions
| that are inflexible, poorly documented, and unmaintained.
|
| Boilerplate generally exists for a reason, and it's not
| because the creator likes typing.
| chrsig wrote:
| Possibly yes, if you're only contrasting it with being able
| to be faster.
|
| I mean, it's sort of a false dichotomy -- it's omitting a
| "default speed" for writing boilerplate that is neither
| enhanced nor impeded.
|
| the potential issue with an enhanced speed for writing
| boilerplate is that it means that there'll just be more and
| more boilerplate to maintain over time, and it's not clear
| what that cost over time will be.
|
| How much more effort will be expended to replace things in
| multiple places? It exacerbates existing issues of "these
| two things look almost the same, but someone manually
| modified one copy...should that change be propagated?"
|
| Meaning, it's essentially an ad-hoc code generator. Code
| generation can be a very useful technique (see protobufs),
| but without the ability to re-generate from a source?
|
| Perhaps a possible enhancement might be for copilot to keep
| track of all blurbs it generated and propose
| refactoring/modifying all copies?
| airstrike wrote:
| _> I mean, it 's sort of a false dichotomy -- it's
| omitting a "default speed" for writing boilerplate that
| is neither enhanced nor impeded._
|
| I'm not sure. I think that understanding is omitting a
| "default amount" of boilerplate that will have to be
| written regardless of one's individual preference that is
| really a function of the language / framework of choice,
| the existing codebase and the problem at hand.
|
| Removing that boilerplate would be ideal but is not
| always possible given limited resources, time constraints
| and the usual inability to make sweeping changes to the
| codebase
|
| So we settle for the second best solution which is to
| automate away that tedious process (or short of that
| provide developers with tools to get it out of the way
| faster) so we can all focus on "real work"
| pc86 wrote:
| Writing a slightly abstracted library to handle populating a
| list isn't necessarily "fixing" something. It might be, for
| sure, but is going to be very use case dependent, and there
| are a _lot_ of instances where it 's better to have 5, 10, or
| yes even 15-20+ nearly-identical lines and be done in a
| minute or two (or 5 seconds with Copilot IME) than spend half
| a day tweaking test coverage on your one-off library.
| capableweb wrote:
| > Writing a slightly abstracted library to handle
| populating a list
|
| > than spend half a day tweaking test coverage on your one-
| off library
|
| If you need to write a library and spend half a day to
| populate a list, you have bigger problems than boilerplate.
|
| Nothing wrong with having duplicate lines. The problem
| becomes when writing those lines become automated so you
| start spewing those all over the place.
| nemo1618 wrote:
| I wrote a test recently for a simple "echo"-style server:
| clients writes a name to a socket, server replies with "Hello,
| " + name. Nothing crazy.
|
| In the test body, I wrote "foo" to the socket. Copilot
| immediately filled in the rest of the test: read from the
| socket, check that the result is "Hello, foo", and fail the
| test with a descriptive error otherwise.
|
| wtf? How did it figure out that the correct result was "Hello,
| foo"? I changed "Hello" to "Flarbnax", and sure enough, Copilot
| suggested "Flarbnax, foo". I added a "!" to the end, and it
| suggested that too. After pushing a bit further, the
| suggestions started to lose accuracy: it would check for "???"
| instead of "??" for example, or it would check for a newline
| where there was none. But overall I came away very impressed.
| speedgoose wrote:
| It does the boring code for me.
|
| If I want to throw an exception if an object is null or
| undefined, Co-pilot will do the if and the exception throw
| using the right error class, and a more meaningful error
| message that what I usually came up with.
|
| If want to map some random technical data table to something
| useful in my programming language, I can copy paste the data
| from the documentation in pdf or html into a comment block,
| give an example, and co-pilot will write everything in the
| format I want.
|
| If I want to slightly refactor some code, I can do it once or
| twice and co-pilot can help me a lot to refactor the remaining.
|
| If I want to have a quick http server in nodejs, I don't have
| to Google anything.
|
| It's a lot of tiny things like this.
| TaupeRanger wrote:
| This is the kind of thing I would need to see in real time,
| because I simply can't believe that it does any of these
| things in a way that is reliable and doesn't involve having
| to search through and make sure it hasn't made any mistakes,
| taking just as much time as if you did it by hand.
| gfosco wrote:
| Likewise skeptical, but I have been super impressed with
| it. I just got in to the technical preview, and worked
| through a specific task I needed to do (involving mongoose,
| a mongo aggregate query, a few loops, some date functions)
| and started by adding a comment above each line. It helped
| a lot actually, felt like a collab.
|
| I'll reproduce a generic example I sent a friend.
|
| Prompt: const redis = require('redis');
| // Create a redis client
|
| Copilot suggested: const client =
| redis.createClient();
|
| I accepted it and moved 2 lines down, prompt:
| // Get the current count from redis
|
| Copilot suggested a start to the operation:
| client.get('count', (err, count) => {
|
| I accepted it, and Copilot continued:
| if (err) { console.log(err);
| return; } // If there is no count,
| set it to 0 if (!count) { count = 0;
| } // Increment the count count++;
| // Set the new count in redis client.set('count',
| count); // Log the new count
| console.log(count); }
| foepys wrote:
| Redis has the INCR command that does this in redis
| without the additional round-trips (and race conditions).
| It also sets the value to 0 if the key doesn't exist.
|
| So, I actually consider this to be exactly the bad
| behavior that people accuse Copilot of.
| speedgoose wrote:
| Yes it's not very shinning there. I would also throw the
| error instead of printing the error to the console and
| returning undefined.
| ponyous wrote:
| You are in a callback there. Goodbye your error!
| gfosco wrote:
| This was just one of its suggestions, but you're right of
| course.. it's all based on the training data and idioms
| used there. If it doesn't weight more modern code higher,
| if it's not aware of new versions and methods, it isn't
| going to be super intelligent.. but it can still give you
| some ideas.
| matsemann wrote:
| // Create a redis client
|
| Writing that probably takes a longer time than just doing
| it with the IDE help in jetbrains, though?
|
| Press "r", press "." to autocomplete so it now says
| "redis.", then write "cC" and it suggests createClient
| (or write "create" or "client" if you're not sure what
| you're looking for). Now it says "redis.createClient()".
| Press ctrl+alt+v to extract a variable or write ".const"
| and press tab to apply the const live template. Ending up
| with your result in two seconds.
| aaaaaaaaaaab wrote:
| Why does it increment the count?
| gfosco wrote:
| I assume that in its training, incrementing a counter in
| redis is common.
| baby wrote:
| I was really skeptical at first, but after using it for a
| while omg it is just insane.
| Polycryptus wrote:
| It's _very_ good at "learn by example" with some twists. It
| _does_ make mistakes, and I do double check it, but it
| still definitely saves time. I used it to write the bulk of
| a new implementation of a new audio backend for a game
| engine yesterday - it filled out a lot of the "boilerplate"
| integration work (e.g. generating all the functions like
| "set volume/pan/3D audio position" that map over 1:1 to
| functions in the other library).
|
| I will say, though, that it's also good at making up code
| that looks very believably real but doesn't actually work.
|
| The ethics involved in Copilot are a bit strange, and I'm
| not sure I'll keep using it for those reasons, but it does
| a good job.
| meijer wrote:
| I wonder when it will become generally available. Feels like it
| has been around for quite a while now.
| eikenberry wrote:
| Any word on if they will ever make Copilot free software? It
| sounds interesting, but I avoid using proprietary software in my
| development stack. Plus it looks like it be fun to play with.
| jkelleyrtp wrote:
| I actually really like Copilot.
|
| There tends to be a lot of repetitive code in the world. I
| primarily write JS, Py, and Rust. Sometimes, I might declare
| something like a function table, and Copilot will automatically
| fill in the class definition with everything I defined.
|
| I'm not using Copilot to write new algorithms or solve library-
| specific problems, but it sure is next-level in picking up
| patterns in a file and predicting where you want to go next.
| Obviously, good code is succinct (not repetitive), but it sure is
| helpful when in that early prototyping stage. I admire it's
| ability to infer a correct assertion when writing Unit Tests - it
| made it much easier for me to write tests recently and helped me
| recognize a few bugs.
| threatofrain wrote:
| I've been getting a lot more misses than hits with Github
| Copilot, even when writing elementary math or utility functions;
| but despite its error I am nevertheless astonished at its
| approximation of intent.
|
| Very eager to see Github Copilot catchup to some bright line of
| signal v noise.
| baby wrote:
| I would say the reverse, I'm getting so many hits that I'm
| mindblown. And when it missed, I can generally still use that
| and fix the suggestion, as it's faster.
| f38zf5vdt wrote:
| It's a glorified autocomplete to me. It seems like it feeds
| me mostly things I'd get from searching Stack Overflow. The
| first day was pretty interesting but the novelty wore off
| quickly. You still need to grok what it spews out and see if
| it's correct.
|
| And the worst thing about that is that you don't get the
| context of the Stack Overflow threads, where people discuss
| the impact of the given solution and alternatives. So after a
| week, off it went for me.
| mistrial9 wrote:
| this has been "inevitable" for three decades now. The difference
| is, walled gardens making participation non-optional; commercial
| intent over "fairness"; elevating the trivial for the pleasure of
| management .. what could go wrong?!
|
| overall, a new forms generator with a somewhat terrifying amount
| of horsepower.. zero trust of microsoft here, basically
| baby wrote:
| I've been using this for weeks and it blooooows my mind. It comes
| up with crazy recommendations, just yesterday I wrote this big
| ass logic to do something, then I wanted to move that code to a
| function so I wrote the function name and I kid you not copilot
| suggested a one-liner that worked... the thing is so useful and
| I'm not writing simple code (writing cryptographic code). And
| when it's not doing that at the very least it provides auto-
| completion to lists where a counter has to increase and things
| like that. It's just baffling, I don't think I'm that directly
| impacted by AI, or at least this is the first time where I'm like
| "wow, AI really is changing the world RIGHT NOW". Half-joking:
| can't wait for it to just write my code.
|
| Also if this feature would be paid tomorrow, I think I would pay
| for it. It's really noticeable when I don't have copilot enabled
| now.
|
| Oh and, autocompletion doesn't work with markdown files because
| of markdown plugins I think? But this is another level of
| insanity: when I'm writing english it figures a lot of the
| sentences I want to write. Makes me question if I'm just a
| deterministic individual with no choice.
| luckyorlame wrote:
| can it do my cs homework?
| netcyrax wrote:
| Why are people not bothered by privacy concerns in this case?
| jmnicolas wrote:
| I suppose this thing upload your code to Microsoft servers then
| run some deep learning algos on it and get back to you with
| suggestions? It also probably keep your code to feed it to the
| algos.
|
| If big tech was trustworthy I would use this with glee. But
| when I see how the world is turning, I'll continue to type
| boilerplate by hand (as long I'm allowed).
| bogwog wrote:
| Because the generation that grew up without any privacy is
| growing up and getting jobs in tech.
| lvass wrote:
| They're good kids who won't have to worry about their social
| credit.
| truculent wrote:
| The comments are so full of praise that I will have to give this
| an earnest try. But is _writing_ code really the part of software
| that people are struggling with?
| f38zf5vdt wrote:
| I used it for about a week but found I could type faster than it
| could suggest, even if it suggested the right thing. I have been
| coding for about 25 years but maybe it will help people new to
| whatever language they are using.
| yunji wrote:
| How does this compared with tabnine? could these 2 plugins be
| used together?
| aimor wrote:
| I'm very interested in this as a learning tool: instant feedback
| about what could come next, compared to the status quo of
| searching the internet or searching the language documentation. A
| lot of the time I learn _a_ way to do something, then sometime
| later stumble across a _better_ way to do the same thing. My hope
| is that Copilot can be a shortcut for that discoverability.
| pugets wrote:
| Copilot is crazy. The other day, I was writing a Python function
| that would call a Wikipedia API. I pulled from the internet an
| example of a GET request, and pasted it as a comment in my code.
| # sample call: https://en.wikipedia.org/w/api.php?action=query&fo
| rmat=json&list=geosearch&gscoord=37.7891838%7C-122.4033522&gsradi
| us=10000&gslimit=100
|
| Then I defined a variable, base_url =
| "https://en.wikipedia.org/w/api.php?"
|
| Then, like magic, Copilot suggested all the remaining keys that
| would go in the query params. It even knew which params were to
| be kept as-is, and which ones would come from my previous code:
| action = "query" # action=query format = "json" # or xml
| lat = str(latitude.value) # 37.7891838 lon =
| str(longitude.value) # -122.4033522 gscoord = lat + "%7C"
| + lon ... api_path = base_url + "action=" + action +
| "&format=" + format + ... + "&gscoord=" + gscoord
|
| As a guy who gets easily distracted while programming, Copilot
| saves me a lot of time and keeps me engaged with my work. I can
| only imagine what it'll look like 10 years from now.
| c7DJTLrn wrote:
| Bit of a dodgy way to form query parameters though. Other than
| for a quick script.
| sillysaurusx wrote:
| Speaking as a former pentester, this is a fine way to form
| query params in this specific case, _if_ lat and long are
| floats.
|
| They're the only data you can control, and unless they're
| strings, it's useless for exploitation. Even denormal floats
| / INF / NAN won't help achieve an objective.
|
| I broadly agree with you, but people are pummeling Copilot
| for writing code that I saw hundreds of times. Yes, sometimes
| I was able to exploit some of that code. But the details
| matter.
| boredtofears wrote:
| If the example code is everything that Copilot generated,
| there's no guarantee that lat or long are floats and that
| seems to be an implementation detail left to the user.
|
| Isn't that a pretty big risk though? Specifically, that
| people will use co-pilot recommendations "as-is" and give
| little thought to the actual workings of the
| recommendation?
|
| After all, if you have to intimately understand the code
| it's recommending are you really saving that much time over
| vetting a Googled solution yourself?
| Matthias1 wrote:
| I'm not against "copying" code. I just looked up "python
| build url query" The first link describes the `urllib.parse.
| urlencode` function which takes a dict.
|
| So I would build the query like so: from
| urllib.parse import urlencode urlencode({
| "action": "query", "format": "json",
| ... "gscoord":
| f"{str(latitude.value)}|{str(longitude.value)}", })
|
| I think this is orders of magnitude clearer code. But that's
| a parameter that's subjective that CoPilot can't adjust for
| (although it can be better).
| lambdaba wrote:
| This. Code should be optimized for reading, I think this
| kind of code is OK for exploratory stuff, but needs to be
| rewritten later.
| snicker7 wrote:
| Well. Code should be optimized first for correctness, and
| simple string concatenation will not work for URL params.
| e0a74c wrote:
| I'm surprised no one has suggested using `requests`
| considering how easy, safe and readable it is:
| >>> import requests, pprint >>> >>>
| >>> url = "https://en.wikipedia.org/w/api.php" >>>
| resp = requests.get( ... url, ...
| params=dict( ... action="query",
| ... list="geosearch", ...
| format="json", ... gsradius=10000,
| ... gscoord=f"{latitude.value}|{longitude.value}"
| ... ) ... ) >>> >>>
| pprint.pprint(resp.json()) {'batchcomplete': '',
| 'query': {'geosearch': [{'dist': 26.2,
| 'lat': 37.7868194444444,
| 'lon': -122.399905555556,
| 'ns': 0, ...
| jtsiskin wrote:
| Even for a quick script this worries me about copilot; if it
| suggests this, then more people use it and think this is
| right, commit it, and then copilot suggests this more -
| that's a bad feedback loop. At least in StackOverflow you get
| someone commenting why it's bad and showing how to use a
| dictionary instead
| ljm wrote:
| Copilot may be the first of many computer dictionaries and
| thesauruses.
|
| Oxford English Dictionary, for example, is a human version of
| defining language and a thesaurus is a completion engine.
|
| Human language didn't suffer by having a dictionary and
| thesaurus. Computer language doesn't suffer either.
| pugets wrote:
| It probably does suck! I'm not very experienced, and I was
| just whipping up something quick to test if my random
| MSFS2020 mod idea could work.
| relativeadv wrote:
| How so?
| foepys wrote:
| It has no escape logic. Okay for scripts, as GP stated,
| very bad for production code.
| Jon_Lowtek wrote:
| code lacks context sensitive escaping
| api_path = base_url + urllib.parse.urlencode({
| 'action': action, 'format': letThisBeVariable,
| ... 'gscoord': str(latitude.value) + '|' +
| str(longitude.value) })
|
| see: https://docs.python.org/3/library/urllib.parse.html#ur
| llib.p...
|
| Mantra: when inserting data into a context (like an url)
| escape the data for that context.
| firebaze wrote:
| Concatenating strings for example. As shown, it's the query
| string equivalent of sql injection.
|
| Use something like URLBuilder, or URIParams, or whatever
| your platform supports. Don't use string concatenation
| ever, if at all possible, and if not possible (wtf?), then
| at least escape strings.
| dastbe wrote:
| the "nice" way of doing this would would be to create a
| list of your stringified arguments, mapped urlencoding over
| them, and then join them with the parameter separator. this
| ends up being resilient to someone adding something that
| ends up being incorrect, and makes explicit in the code
| what you're trying to do.
| cmckn wrote:
| I usually try to avoid working with URLs as bare strings
| like this, both for readability and correctness (URL
| encoding is tricky). With 'requests' you can do something
| like pass a dictionary of your query params and it takes
| care of forming the actual request URL.
|
| https://docs.python-
| requests.org/en/latest/user/quickstart/#...
| [deleted]
| gen220 wrote:
| It's much safer (i.e. fewer degrees of freedom for bugs to
| appear) to use f-strings in situations like this one.
|
| One correlated but ancillary benefit, is that there are
| fewer variables to simulate the state for in your brain,
| while you're reading the code. You don't have to wonder if
| a variable is going to change on you, in-between when it is
| initialized and when it is used.
|
| It's safer still to use a library (e.g. urllib3) that does
| encoding for you (allowing you to omit magic strings like
| `"%7C"` from the logic of this function alltogther).
|
| Like GP said, very handy for one-off scripts or areas of
| your codebase where quality is "less important". I may be
| pedantic, but I wouldn't give this a pass on code review.
| [deleted]
| [deleted]
| lijogdfljk wrote:
| How so? I'd prefer a proper structured library, is that what
| you mean? If so, the Copilot code actually seems not dodgy -
| because the author _started_ with `base = ...` , indicating
| that they were string formatting the params.
|
| Or did you mean something else?
| janto wrote:
| For me APIs are actually one of the places it performs the
| worst. Copilot is like having an inexperienced yet annoyingly
| optimistic pair programmer. The code it generates appears
| conceivable in some hypothetical universe. No guarantee it's
| this one though.
|
| Remember it doesn't actually know an API or how it should be
| used: it's putting things together to look like typical code.
| For me that has meant difficult to spot bugs like linking up
| incorrect variables from the rest of my code.
|
| I wish it could integrate the first SO answer to a generated
| question, because I _always_ end up there anyway having to fix
| things.
| ctoth wrote:
| The next version of Copilot will submit its answers to HN and
| return the highest-voted comment that compiles, after stripping
| out the well actually spurious tokens. Just look how well it
| worked this time?
| RheingoldRiver wrote:
| btw the `mwclient` library makes querying the Wikipedia API a
| breeze!
| dec0dedab0de wrote:
| Now we just need to train it to make a dictionary for that info
| instead of forming a long url. But if it has to use a long url
| to use urljoin and/or string formatting.
| bluelu wrote:
| It say on the github page that "GitHub Copilot will attempt to
| match your code's context and style. You can edit the suggested
| code as you choose.". Does this mean that the plugin will
| transmit my code to github servers?
| moyix wrote:
| Yes. The machine learning model runs on GitHub's servers (it's
| too big/expensive to run locally), so it has to submit the
| context of what you're working on to GitHub.
| premek wrote:
| will the plugin steal my employer's code and give it to a
| competition?
| josebalius wrote:
| Here is a demo of it with Neovim & Codespaces:
| https://twitter.com/josebalius/status/1453413543232090118
| ahupp wrote:
| I've been using Copilot in VS Code and it's been surprisingly
| useful. It makes suggestions pretty rarely, but when it does I
| accept about 50% of them. Generally these are few-line functions
| and it just gives me what I would have written after thinking
| about it a moment.
| ghoward wrote:
| I have many thoughts about Copilot, but here are two.
|
| First, as much as I don't like the idea of Copilot, it seems to
| be good for boilerplate code. However, the fact that boilerplate
| code exists is not because of some natural limitation of code; it
| exists because our programming languages are subpar at making
| good abstractions.
|
| Here's an example: in Go, there is a lot of `if err == nil`
| error-handling boilerplate. Rust decided to make a better
| abstraction and shortened it to `?`.
|
| (I could have gotten details wrong, but I think the point still
| stands.)
|
| So I think a better way to solve the problem that Copilot solves
| is with _better programming languages_ that help us have better
| abstractions.
|
| Second, I personally think the legal justifications for Copilot
| are dubious at best and downright deception at worst, to say
| nothing of the ramifications of it. I wrote a whitepaper about
| the ramifications and refuting the justifications. [1]
|
| (Note: the whitepaper was written quickly, to hit a deadline, so
| it's not the best. Intro blog post at [2].)
|
| I'm also working on licenses to clarify the legal arguments
| against Copilot. [3]
|
| I also hope that one of them [4] is a better license than the
| AGPL, without the virality and applicable to more cases.
|
| Edit: Do NOT use any of those licenses yet! I have not had a
| lawyer check and fix them. I plan to do so soon.
|
| [1]: https://gavinhoward.com/uploads/copilot.pdf
|
| [2]: https://gavinhoward.com/2021/10/my-whitepaper-about-
| github-c...
|
| [3]: https://yzena.com/licenses/
|
| [4]: https://yzena.com/yzena-network-license/
| miller_joe wrote:
| I've been using TabNine for several years and love it. I'd be
| interested in hearing a comparison between TabNine and GH Copilot
| from anyone who has used both.
| jimmaswell wrote:
| How could they support these two random IDEs before Visual Studio
| proper?
| jmnicolas wrote:
| A few months ago at work I had some suggestions in VS to allow
| for a better intellisense with the help of AI. I think it was
| probably this.
|
| I didn't allow it since I think it implied uploading my code to
| their servers.
| lionkor wrote:
| Good, I was getting really tired of subtly plagiarizing by hand.
| chefandy wrote:
| Yesterday, I was disgusted to see framers putting up a house
| that clearly plagiarized the entire internal structure of my
| own. Same joint interfaces, same structural idioms when dealing
| with things like staircases, windows, and rafters, same
| fasteners, same adhesives, even the building materials! Aside
| from the most general aspects of the layout, it was exactly the
| same right down to the inch! People have no professional
| integrity these days.
| bogwog wrote:
| That analogy only works if you designed/architected your own
| house.
| sterlind wrote:
| copilot's won't suggest anything worth calling plagiarism,
| just mundane plumbing and maybe textbook algorithm
| implementations. have you seen it generate anything more
| glorified than StackOverflow-esque code snippets?
| danuker wrote:
| It's dicey according to the GPL FAQ [1]. It goes against
| what GPL authors want: their work being used in
| proprietary projects.
|
| This could have been prevented very simply: GitHub
| avoiding training Copilot on GPL code.
|
| What they can still do is offer a new model excluding GPL
| code for people who care about it.
|
| [1] - https://www.gnu.org/licenses/gpl-
| faq.en.html#SourceCodeInDoc...
| smitop wrote:
| They would also have to exclude virtually _all_ code that
| isn 't public domain, too. MIT and Apache-2.0 and BSD all
| require that the copyright notice and license text is
| preserved in downstream use.
| aziaziazi wrote:
| It may work if you design/architect houses for clients.
| chefandy wrote:
| Plagiarism can only be spotted by people who wrote the
| original work?
| standardUser wrote:
| I just call that "programming".
| fouc wrote:
| As the saying goes, "A good programmer copies, but a great
| programmer steals outright."
| snvzz wrote:
| Still no way to opt your code out of this.
|
| Disgusting.
| sergiomattei wrote:
| Don't open source your code then.
| bogwog wrote:
| Microsoft: 1 Open Source: 0
| drran wrote:
| Find a torrent with sources of M$ Windows and copilot them:
| M$: 1, Open Source: 1.
| kadoban wrote:
| Open Source has licenses that must be followed. Copilot
| strips those off and ignores them.
| IshKebab wrote:
| What if I - a human - read your code, learn from it, and
| then use that knowledge to write my own code? Am I
| stripping your license off and ignoring it?
|
| Clearly it's not as simple as you imagine.
| kadoban wrote:
| It depends how much you "learn from it" and then write
| your own code vs how much you copy/paste.
|
| Copilot is pretty commonly just copy/pasting. You can get
| it to spit out exact copied code, including comments.
|
| p.s. "it's not as simple as you imagine" is pretty
| dickish. Why include that?
| ghoward wrote:
| It is. Machines are running algorithms, which, by
| definition, are not creative.
|
| Of course, people may argue that people are not creative,
| but considering that for a recent court case, it was
| decided that AI cannot be an inventor, it _does_ matter
| to _that_ court at least.
| rectang wrote:
| Legally, it needs to be _opt-in_ in order to protect downstream
| consumers of code written by Copilot.
|
| Copilot sometimes reproduces code verbatim. You can't use open
| source code except under the terms of the license. Authors
| whose code may be reproduced by Copilot need to grant a license
| to downstream consumers, and republishers of Copilot-generated
| code need to adhere to the terms of that license.
|
| Copilot is inserting ticking time-bombs into its users'
| codebases.
| miohtama wrote:
| Only if the threshold of originality is passed. I feel many
| of Copilot snippets are so tiny that this threshold is not
| reached. But not a judge here.
|
| https://en.wikipedia.org/wiki/Threshold_of_originality
| rectang wrote:
| The threshold of originality is clearly being reached some
| of the time:
|
| > Copilot regurgitating Quake code, including sweary
| comments (twitter.com/mitsuhiko)
|
| https://news.ycombinator.com/item?id=27710287
| dragonwriter wrote:
| If it is relevant at all, the threshold of originality
| applies to the allegedly-copyrighted source consumed by
| Copilot (as regards bare infringement, not _wilfull_
| infringement). If _that_ doesn 't meet the threshold, it is
| not copyrightable. If it is, unauthorized copying not
| within a copyright exception (e.g., fair use) is
| infringement.
|
| I can't see any case where originality of the _snippet
| presented by Copilit_ matters (if Copilot were a person, it
| would matter to determining if the snippet _on its own_ was
| copyrightable by Copilot, but still wouldn 't be relevant
| to whether to original copyright was violated.)
| meetups323 wrote:
| Nope. Copilot _users_ are inserting "ticking time-bombs"
| into _their own_ codebases.
|
| The buck stops with the user, when they use code from _any
| source at all_ , whether it's their head, the internet, some
| internal library, lecture notes, a coworker, a random dude of
| the street, or who knows what else, it _their own
| responsibility_ to ensure the code they 're using has been
| released under a license they can use. They don't get to go
| back and point fingers just because they didn't do their own
| due-diligence.
|
| The exception would be if a vendor provides code under a
| legal contract providing liability and an agreed license,
| that has not happened in this case so there's no reason to
| expect any legal protections.
| rectang wrote:
| We agree that downstream users who redistribute copyrighted
| code regurgitated by Copilot are in violation of copyright.
|
| It doesn't seem to me as though the distinction between
| "Copilot reproduced the code and the engineer
| copy/pasted/saved it" versus "Copilot inserted the code" is
| crucial.
|
| There's a separate question about Microsoft's own
| liability. When Copilot reproduces open source code without
| adhering to the terms of the license, that's redistribution
| and thus copyright infringement. A copyright owner might
| not be able to get substantial monetary damages, but they
| ought to be able to get a copyright injunction.
|
| I wonder what happens to Copilot should a Github user
| secure injunctive relief, forcing Microsoft to exclude
| their code from Copilot.
| meetups323 wrote:
| > It doesn't seem to me as though the distinction between
| "Copilot reproduced the code and the engineer
| copy/pasted/saved it" versus "Copilot inserted the code"
| is crucial.
|
| Yes, the only thing that matters is who authorized the
| code to be published, which is never Copilot (an
| automated system that takes tickets, has copilot craft
| patches from them, then publishes them with no human
| review would be a) very cool and b) an incomprehensibly
| terrible idea; but even then there is still a human
| authorizing the code to be published, just residing a
| level of abstraction removed from the process itself)
| baby wrote:
| This reaction is why we can't have nice things :( after trying
| copilot I'm convinced that this kind of feature is going to
| bring the world to a next phase. Open source was part 1, this
| is part 2.
| snvzz wrote:
| I understand a lot of people are ok with this and that's
| fine.
|
| There's still no good reason I cannot opt my code out of it.
| rectang wrote:
| I would seriously consider opting in so long as my
| authorship was acknowledged and my license was upheld. FWIW
| I tend to release things under permissive licenses
| (although I think if I was copyleft-inclined I might feel
| the same way: just match my license).
|
| But stripping my copyright, copying my work _without_ my
| permission and presenting it to users on terms I did not
| agree to, all of that is unacceptable.
| boredtofears wrote:
| I legit cant tell if the github fanboyism is this real or if
| this is just a typical product launch astroturfed comment
| thread
| belter wrote:
| A friend of a friend, told me he is furiously adding code to
| Github, with subtle security bugs. He can't wait for it to show
| up in the proper places...Courtesy of Copilot ;-)
| threatofrain wrote:
| But people already naturally exhibit subtle bugs in the
| course of ordinary programming. Your acquaintance will just
| be another drop in the ocean.
| jmnicolas wrote:
| Except he knows what to look for and how to exploit it.
| Could lead to easy bug bounty money.
| benburleson wrote:
| Seems like an exceptionally risky attempt to make money
| using programming skills. Why not directly add value to
| the software world?
| jmnicolas wrote:
| I'm not endorsing it. FWIW I won't use Copilot and won't
| add (voluntarily that is ;) bugs in my code to sabotage
| it.
| jeroenhd wrote:
| I wonder if that could be a nice money maker. Introduce a lot
| of generic functions with common names, add security bugs.
| Maybe add a README entry telling people to not trust the code
| because you're using it to demonstrate what insecure code
| looks like, and then wait for some big company with a bug
| bounty to introduce it to their code base. License your code
| proprietary of AGPL to make sure the company is the one who
| gets in trouble if they admit the code comes from you.
|
| With enough nearly-working functions spread across multiple
| projects in every language known to man, you could
| practically automate your way into a steady stream of hacker
| bounties.
|
| People would probably call it unethical, but if Copilot's
| massive IP violations are okay then who cares. As long as the
| project's security flaws are recognisable by humans it
| doesn't matter IMO.
| [deleted]
| moyix wrote:
| This attack has been studied!
|
| https://arxiv.org/abs/2007.02220
|
| Although our own work shows Copilot is pretty good at adding
| security flaws on its own:
|
| https://arxiv.org/abs/2108.09293
| WillPostForFood wrote:
| Yes there is, make your repo private.
| unpipable wrote:
| Copilot has been super fun! Here is a small website I generated
| via only comments - in the HTML and JS. The CSS needed a bit more
| massaging but it also auto generated.
|
| https://spencer0.github.io/copilot-tests/
| lelandfe wrote:
| <!-- Details on the fall of rome --> <p>The
| fall of rome was a great event for the people of rome.
| leodriesch wrote:
| AI comedy gold
| petepete wrote:
| Wait, they got Tim Pope on the case for the Neovim plugin?
| Amazing, I'm positive it'll work beautifully.
|
| For those who don't know, he's essentially the godfather of vim
| plugins - I even have an entire 'tpope section' in my init.vim
| fouc wrote:
| Haha, I mean, tpope has been working on vim plugins since
| 2005/2006 from my IRC memories, but there were vim plugins
| before that too.
| parhamn wrote:
| I tried it on IntelliJ recently. The examples I tested blew my
| mind. Yet, I think there are two things that need to improve to
| get me to use it regularly (it will get there!):
|
| - less than perfect import/types/var suggestions that LSP in
| typed languages would've made perfect suggestions for (e.g named
| import in go would use the package name instead).
|
| - latency feels a bit high and my thoughts would get interrupted
| waiting for a suggestion to come.
|
| For the former, I wonder hard feasible it would be to give
| structured suggestions to the LSPs that it would swap for correct
| var names and imports and such. Or test each suggestion with the
| LSP for error counts and offer the least erroring suggestion.
| sillysaurusx wrote:
| > latency feels a bit high and my thoughts would get
| interrupted waiting for a suggestion to come.
|
| How high? That's interesting.
| truly wrote:
| This will lead IMO to an interesting problem, although the
| technology and the idea is certainly cool.
|
| Currently many programmers do not take the time to really
| understand how/why their code works -- programming without
| understanding 1.0. Essentially make library calls and fuzz around
| with the arguments until it appears to work. [Not
| wanting/suggesting to go back to the world before libraries/code
| completion, just stating where we are now.]
|
| This will enable programming without understanding 2.0 -- not
| only will you not know how/why a particular function call works,
| you will now fail to understand why you want a sequence of
| functions in a particular order.
| kesslern wrote:
| Is anyone able to install the plugin yet? I'm not seeing it when
| I search the plugin marketplace in Rider.
| thrower123 wrote:
| Saw a review the JetBrains page that Rider isn't officially
| supported, but they got it to work anyway, although they don't
| say how
|
| https://plugins.jetbrains.com/plugin/17718-github-copilot/re...
| kesslern wrote:
| Looks like I can download it from the plugin page and
| manually install the zip file. Thanks!
|
| https://plugins.jetbrains.com/plugin/17718-github-
| copilot/ve...
|
| EDIT: Hmm, it installed but it refuses to run.
|
| EDIT2: Looks like you can force the plugin to work by editing
| the plugin.xml contained in github-copilot-intellij-1.0.1.jar
| within the plugin archive. Just remove the line that includes
| Rider as incompatible. The same should work for CLion.
| ausbah wrote:
| the fact that most of Co-Pilot's usefulness comes from repeating
| common snippets of code makes me think there has to be a much
| simpler way to reduce the boilerplate of "common tasks"
| AnthonBerg wrote:
| In my opinion, dependent type systems are that way.
|
| A dependent type is a type that depends on a value. What
| something is depends on something else; What something _is_ is
| derived from something else - with computation. What dependent
| types _are_ are _calculations of type structure_.
|
| Unbounded, this becomes intractable like all unbounded
| computational expressivity. So that's what modern dependent
| type systems need to solve--and they do. There exist formal
| results that frame the computational expressivity of dependent
| type systems and make perfectly feasible and tractable the task
| of deriving significantly complex types. Automatically.
|
| The Idris language is a great example of where we're heading.
|
| The reason I'm more interested in this sort of thing rather
| than Copilot is that dependent type systems are based on
| formally rigorous methods. You end up with formally verified
| programs, by way of the same mechanisms that allow you to
| derive them automatically. They're also easier to compose, for
| the same reasons.
|
| Edwin Brady's Idris demonstratons on Youtube show a bit of
| what's possible. In one, the compiler automatically writes a
| formally-correct type-directed matrix multiplication function.
| In another, run-length encoding and decoding functions are
| generated from a type definition.
|
| The book Type-Driven Development with Idris is a great read.
| Mind-expanding.
|
| Programming is automation. The automation of automation is...
| dependent types.
| api wrote:
| Formally rigorous methods have almost always lost out in the
| market against slop like JavaScript.
|
| I think the reasons are completely pragmatic and boil down to
| two things.
|
| The first is that rigorous systems usually take longer to
| build and meanwhile the slop ships first and gains mindshare.
|
| The second is that rigorous systems are usually built by
| academics or specialists in some specific vertical and lack
| the easy installation, easy onboarding, and integration with
| other platforms that more pragmatic sloppy platforms tend to
| prioritize first. Those things get prioritized first because
| sloppy languages and systems tend to evolve from makeshift
| "shop jigs" used to get stuff done, not from research.
| IshKebab wrote:
| Why? I haven't used it but it seems like the only reason it is
| good at repeating common snippets of code is because it is so
| clever. I don't think a simpler solution would be possible
| because it isn't _exactly_ repeating code (except in contrived
| examples). It 's adapting it to the context.
| cultofmetatron wrote:
| common lisp's macros are the most powerful abstraction. that
| said, its a VERY sharp tool
| tdiggity wrote:
| Anyone know how long the waitlist is?
| mikeywazowski wrote:
| I joined the waitlist at the end of June and got an invite
| yesterday. So 4 months?
|
| However, I imagine a lot of people signed up just before me, so
| I was probably at the end of a long list. The wait wouldn't be
| this long if you sign up today, I reckon. I'm just guessing
| though.
| giuseppeciuni wrote:
| I signed up copilot on june... still received nothing
| unfortunately!!!
| dgdosen wrote:
| I just tried installing for neovim - but got an error running
| vim-plug's `:PlugInstall`
|
| I added an issue.
| https://github.com/github/feedback/discussions/6847
|
| Anyone else install in neovim?
| urmish wrote:
| The copilot docs say you need a prerelease version of neovim.
| Maybe that's the reason? homebrew might get you 0.5.2. The
| nigthly gives you 0.6.xx
| Thorentis wrote:
| In my opinion, Copilot is going to become one of those "perceived
| authorities" that have just enough legitimacy to be blindly
| trusted by the inexperienced, but not enough to actually be
| useful to the experts.
|
| This is like social media (or even the Internet as a whole) and
| say, our parents' generation. Countless times I receive links to
| Facebook posts or random articles that somebody thinks must be
| true, simply because The Oracle (i.e. their smartphone) showed it
| to them. For much of the older generation, smartphones are these
| all-knowing repositories of wisdom, and anything they come across
| while using them is likely to be true. This is why I think
| misinformation has spread so easily.
|
| I imagine Copilot going down a similar path. The next generation
| of programmers who didn't grow up with knowing how to sift
| through API docs or SO answers for the right bit of code, or
| who's attention spans have been fizzled away, will love the idea
| of Copilot. Instant gratification in the firm of a tool that can
| seemingly do your work for you. This will be dire consequences
| for their ability to code and think for themselves.
| shanebrunette wrote:
| Emacs please
| da39a3ee wrote:
| It does seem a bit controversial to develop a relationship with
| neovim without approaching emacs. I wonder if they even asked
| on emacs-devel, I'm sure they'll have got a friendly response
| ...oh hang on...
| synergy20 wrote:
| I hope it will work for the 'standard' vim, so far it reports
| 'vim version too old', while I'm using the newest vim.
|
| it's said because vim lacks 'virtualtext' feature.
| Spinnaker_ wrote:
| How well can copilot write unit tests? This seems like an area
| where it could be really useful and actually improve software
| development practices.
| kqr wrote:
| If you're looking for test case generation there are already
| mature tools for that. I doubt anything generic could improve
| on those.
| ericlewis wrote:
| any suggestions for said tools?
| svieira wrote:
| QuickcCheck-type tools (generators for tests that know
| about the edge cases of a domain - e. g. for the domain of
| numbers considering things like 0, the infinities, various
| almost-and-just-over powers of two, NaN and mantissas for
| floats, etc.):
|
| * QuickCheck:
| https://hackage.haskell.org/package/QuickCheck
|
| * Hypothesis: https://hypothesis.readthedocs.io/en/latest/
|
| * JUnit QuickCheck: https://github.com/pholser/junit-
| quickcheck
|
| Fuzz testing tools (tools which mutate the inputs to a
| program in order to find interesting / failing states in
| that program). Generally paired with code coverage:
|
| * American Fuzzy Lop (AFL): https://github.com/google/AFL
|
| * JQF: https://github.com/rohanpadhye/JQF
|
| Mutation / Fault based test tools (review your existing
| unit coverage and try to introduce changes to your
| _production_ code that none of your tests catch)
|
| * PITest: https://pitest.org/
| prionassembly wrote:
| Hypothesis for Python.
|
| Schemathesis builds on Hypothesis and generates tests from
| OpenAPI specs.
| sixstringtheory wrote:
| I think replies mentioning automatic unit test generation miss
| the point.
|
| To me, the value of copilot helping to write tests is that we,
| the engineers, come up with the test cases, and copilot helps
| write the code for that case.
|
| I think humans will still be more imaginative in the test cases
| they can dream up (although I've never used an automatic
| generator, maybe they're better than I think), but almost all
| test code is boilerplate, either in the setup or the
| assertions.
|
| If I don't have to write that repetitious, yet slightly
| different boilerplate for each test case, that frees me up to
| design other interesting test cases (as opposed to getting
| tired of the activity by the time I cover the happy path) or
| move on to the next bug/feature work.
| manquer wrote:
| Writing tests for the sake of coverage is already practically
| useless which is what a lot of orgs do, This could maybe
| generate such tests. However it doesn't materially impact
| quality now, so not much difference if automated.
|
| One of the main value props for writing meaningful unit tests,
| is it helps the developer think differently about the code he
| is writing tests for, and that improves quality of the code
| composition.
| Graffur wrote:
| Why is that useless? Codebases I have worked on that had high
| code coverage requirements had very little bugs.
|
| * It promotes actually looking at the code before considering
| it done
|
| * It promotes refactoring
|
| * It helps to prevent breaking changes for stuff that wasn't
| supposed to change
| manquer wrote:
| The example i usually give [1] in javascript is say you
| have function (x,y) => x + y
|
| Orgs targeting code coverage write a test for 1,2 => 3 and
| get 100% coverage and then _stop_ as there is no incentive
| to go further. They don 't write tests for say
| (1,null) (null,null) ('x',1) (NaN,
| Infinity)
|
| and so on.. these additional tests will improve coverage of
| scenarios and code coverage will not move.
|
| I have seen projects where a test will have sequence of
| steps which trigger the code but the assertion is
| effectively true === true, or they will replicate the same
| function in the test instead of generating proper mock data
| or myriad different absurd testing approaches. This comes
| from twin pressure of showing coverage and having tests
| pass.
|
| Coverage is also a challenge in code which uses AI/ML
| libraries or that use third party services. These really
| need statistical testing with large volume of diverse well
| maintained samples and results need statistical analysis
| for error rates not different from how manufacturing does
| it, I don't see that often. For code using face detection
| for example a single face getting detected or not is hardly
| an adequate test.
|
| Finally, it is easier to improve coverage by testing
| simpler code than improve coverage/ refactor a function
| which has say 10 nested branches, so it is not uncommon to
| see 90% coverage and 10% of the most used / most error
| prone code poorly or not tested at all.
|
| There are some methods to address these like mutation
| testing, do retros for failure of tests to capture
| production bugs, it is not easy to measure and coverage
| driven orgs will not see their metrics moving by doing
| these.
|
| Well written test suites will also have good coverage, but
| not necessarily other way around. Developers who care and
| understand what they are doing and why they are doing it,
| will use coverage as only the _first step_ to see where
| there are gaps in their tests.
|
| Tests are also code that need peer reviewed and maintained,
| if the tests depend on implementation and constantly break
| or contains improper mocks or assert poorly. A lot of not
| well written tests is hindrance to development than aid it.
|
| [1] Yes, most of these are not applicable in a strongly
| typed language, but it is far easier as a illustration .
| Graffur wrote:
| So one argument against code coverage requirements is
| that poor engineers won't test correctly. Without the
| code coverage requirements you're in the same situation.
| crysin wrote:
| Problem is with 100% code coverage of badly guarded /
| implemented code you'll have a fall sense of security if
| you're just looking at coverage as the metric of quality.
| Anytime I've worked with a company who had a required
| code coverage percent, they never actually cared what the
| code being covered looked like only that it was covered
| in some test.
| jmnicolas wrote:
| I don't think there's Infinity in my language, what do
| you use it for except maths?
| eloisius wrote:
| If you are seeking a minimum value within some
| complicated iteration, it's easier to start your min
| accumulator as Inf than null with extra null checks.
| dpryden wrote:
| If you are using floating point numbers implemented in
| hardware, then infinity is absolutely a valid value and
| one that your code will encounter. This is true
| regardless of language, as long as the language requires
| or allows IEEE-754 semantics.
|
| I am not aware of any language (outside of intentionally-
| minimalist esolangs) that doesn't support floating point
| numbers. In some languages (like JavaScript) that's the
| only kind of number you get.
| matsemann wrote:
| I feel the opposite of codebases where having high coverage
| has been a priority:
|
| * The tests doesn't actually test functionality, edge cases
| etc, just that things doesn't crash in a happy-path.
|
| * Any changes to an implementation breaks a test
| needlessly, because the test tests specifics of the
| implementation, not correctness. Thus it makes refactoring
| actually harder, since your test said you broke something,
| but you probably didn't, and now you have to double the
| work of writing a new test.
|
| * In codebases for dynamic languages, most of what these
| tests end up catching is stuff a compiler would catch in a
| statically typed language.
| drran wrote:
| > The tests doesn't actually test functionality, edge
| cases etc, just that things doesn't crash in a happy-
| path.
|
| This is low coverage.
|
| > Any changes to an implementation breaks a test
| needlessly, because the test tests specifics of the
| implementation, not correctness.
|
| This is bad design.
|
| > In codebases for dynamic languages, most of what these
| tests end up catching is stuff a compiler would catch in
| a statically typed language.
|
| So they are not useless.
| matsemann wrote:
| > This is low coverage.
|
| No, as a sibling comment to mine shows, it's actually
| easy to make 100% coverage with bad tests, since one
| doesn't challenge the implementation to handle edge
| cases.
| xtracto wrote:
| I've found that for large codebases of dynamic typed
| interpreted languages Test Coverage is very useful at
| preventing typos or subtle bugs that wouldn't be caught
| otherwise.
| golergka wrote:
| On my current pet project, it has written almost all of the
| tests here: https://github.com/golergka/rs-
| lox/blob/master/src/compiler.... ad here:
| https://github.com/golergka/rs-lox/blob/master/src/scanner.r...
| (albeit not the screwed indentation) completely by itself. I
| didn't even have to write the function names, just a few macros
| to help it along and a couple of examples to teach it to use
| it.
| francilien wrote:
| Here is one: https://www.ponicode.com/
| mooreds wrote:
| Note that you have to have a copilot account and GA is still
| waitlisted.
|
| I filed a PR because it was a bit frustrating to go through the
| entire setup and then find out I needed to be granted access.
|
| https://github.com/github/copilot.vim/pull/2
| neilv wrote:
| A lot of the examples people are giving of code Copilot filled in
| for them sound like what would be called plagiarism, and probably
| also copyright infringement.
|
| Which I think was fairly predictable.
|
| What wasn't predictable was that someone would ship this Copilot
| anyway, consequently exposing their company and their users'
| companies to liability.
|
| Imagine if you hired an intern who was copy&pasting bits of GPL'd
| code throughout your system. This would not be a good job, it
| would be something that needed immediate attention from legal
| counsel and others, and mean reverting every commit the intern
| from heck made if you couldn't prove convincingly it wasn't
| tainted. Especially if you're a startup, who needs to assure
| investor due diligence in good faith that you actually own the
| IP.
| bastardoperator wrote:
| Wait til stackoverflow sues everyone into oblivion!
|
| Letting your intern blindly commit to your code base seems like
| the bigger issue here. The entire purpose of an internship is
| to learn and to be guided by professionals, not to be treated
| as a cheap laborer. You don't hire interns, you train interns.
|
| Have you used copilot or are you speculating?
| neilv wrote:
| If the analogy works better, imagine that you hired _a
| developer_ who copy &pasted GPL'd code throughout your
| system.
|
| (And people couldn't tell in code reviews, nor on other
| occasions to see the code, since it's not normal to recognize
| GPL'd code on sight; everyone just assumed the developer was
| productive.)
| marginalia_nu wrote:
| I think people should be a lot more concerned about the
| possibility of accidentally deriving your work on something
| with an AGPL license.
| neilv wrote:
| If the analogy works better, imagine that you hired a
| developer who copy&pasted _whatever-license-your-company-
| is-most-afraid-of-and-is-highly-likely_ code throughout
| your system. :)
| crispyalmond wrote:
| >The entire purpose of an internship is to learn and to be
| guided by professionals, not to be treated as a cheap
| laborer. You don't hire interns, you train interns.
|
| This has not been my experience. I was dropped into the
| developer team and expected to know the entire tech stack and
| was not trained by anyone from the company at any point. Have
| I been bamboozled??
| deorder wrote:
| I signed up for the copilot technical preview right after it was
| announced a few months ago, but I haven't gotten an invite yet
| while all my friends who signed up later did (I feel a bit left
| out). Is there any way to get an invite sooner? What am I doing
| wrong?
| parafactual wrote:
| I said I use VSCode all the time, which I suspect is the reason
| I got access. (I never use VSCode.)
| deorder wrote:
| I actually do use VSCode (in addition to Vi and Vim) and I
| believe I indicated that.
| Kiro wrote:
| Same and I also signed up right away. Still no invite.
| dragonwriter wrote:
| I said I use VSCode all the time and just got access, having
| signed up at the very beginning (I, in fact, use VSCode all
| the time.)
| meijer wrote:
| Same for me.
| unpipable wrote:
| I singed up in the first week and got my invite on Monday. I
| don't have anything "linked" with my github via vscode or
| anything so I doubt IDE or program usage was a deciding factor.
| I do regularly commit small stuff.
___________________________________________________________________
(page generated 2021-10-27 23:00 UTC)