Player is loading...

Embed

Copy embed code

Transcriptions

Note: this content has been automatically generated.
00:00:01
oh hello everybody
00:00:08
so uh my name's olaf and i'm really excited to be here and present models
00:00:14
a project that provides rich code editing for skyline
00:00:16
text editors such is this call them emacs and beyond
00:00:21
um so briefly about myself i'm an engineer discuss enter our offices on campus here
00:00:28
uh which makes this moment even more special not welcome everybody here uh i'm the author of a code
00:00:34
from our calls colour twenty uh re factoring to cause cortex and metals the project that i'm presenting today
00:00:40
so you may have seen me as soon as a over p. g. young camp and traitor and
00:00:47
so or uh before i get started and does anyone know here but the skeleton or does
00:00:54
quite many hands which is great is better than a few years ago
00:00:57
uh so we're not for profit were established carry p. file on campus
00:01:02
and uh our two primary focuses on on open source and education uh so what i've been doing a
00:01:08
lot up the the signer is working on tooling uh and also if you may see on your badge
00:01:15
we're recognising salad days so um uh and also the the work that
00:01:21
understanding here is really not just me it's been a big collaborative effort
00:01:25
effort with a lot of contributors so uh one highlight hot here i was
00:01:29
working on the loop uh gabrielle into sitting here came from below no um
00:01:34
and mike into martial arts uh advertise lab and we're working together a full time since april
00:01:40
so uh and also wanna mention a few other names
00:01:42
you timber marco alexei you wanted some chain uh so um
00:01:50
before i wanna go and talk about text editing i wanna talk about another topic that we talk a lot about this coloured it's
00:01:56
a up discover centre which is how we grow this colour community uh and i think everyone here are flown all over the world
00:02:03
come um um the president's colour days should also be thinking about this question
00:02:08
is you know we have a scroll community in now in two thousand in nineteen
00:02:12
and and let's say we wanna double it in two thousand twenty one very ambitious goal how do we get there
00:02:19
um and it's really a difficult problem and and and there's no
00:02:24
silver bullet you're gonna have to have a lot of different solutions
00:02:28
so my thesis for the talk today is that improve that
00:02:31
italy is is one component um and i'll tell you why
00:02:36
i think the first question when you on board someone on your team they've never written scallop
00:02:42
the first thing you think about it is you know what editor do you use
00:02:46
what i'd be doing install um and if you are and what id to users colour
00:02:52
you fine for um some credit stack overflow core of people asking
00:02:56
the same question and it's been going on since two thousand and five
00:03:00
and and usually there he plea you know commented people like to have an opinion
00:03:06
uh i i i like this one here uh he says i'm a newbie whisk our
00:03:10
i'm developing a play framework i i've tried to call id based on equips an anthology
00:03:16
uh in my opinion the first one looks not mature yet and intelligent seems better
00:03:21
uh but i find it a bit slow i'm looking for the sublime option but it's not so documented so
00:03:27
i really like this comment because it highlights some of the points
00:03:30
i wanted to make its someone starting um with scarlet but has
00:03:36
like a particular goal i wanted to play up and and uh this person has tried to use different
00:03:42
ideas but is really looking for the sublime option 'cause i'm guessing that's what the person is familiar with
00:03:48
uh but if you've been long enough in in this call community you know that
00:03:53
the most uh put it answer is definitely intelligently without any explanation and
00:03:59
and that's also the yeah so um the two thousand eighties colour developer survey
00:04:05
and i kind of confirms that um eighty one percent of the respondents said that they use intelligent
00:04:10
um and this may not be surprising yeah for the people here in
00:04:13
the audience can i do a small surveyor who uses entirely different colour
00:04:19
yeah that's about me is not maybe first or so
00:04:26
i wanna take a moment here look at that the eighty one percent number because
00:04:33
if you take the global programming community it's not the same
00:04:38
so if you take the get a box covers the kind of their thirty one million programmers
00:04:43
globally and well then and that's a fair estimation i guess good abusers
00:04:48
number of of developers um and um the japanese developer survey
00:04:52
from two thousand eighteen says that they have six million people
00:04:55
who who use japanese products including intelligently and that's a really impressive number and and japanese products are
00:05:01
really fantastic uh but that still leaves twenty five
00:05:05
million programmers out there never even downloaded are installed intelligently
00:05:10
and um yeah so if you the the two thousand eighteen stack overflow developer survey
00:05:17
uh you also see a similar pattern which is that intelligent goes has twenty five percent
00:05:23
of the most popular that like a twenty five percent of the respondents say that today is there you know favour development environment
00:05:30
and it's up to six place there are five other editors
00:05:34
including notepad uh that uh you know are more popular um
00:05:40
yeah but also notable editor searches them sublime text and visual studio code so
00:05:47
there is an editor gap there like the representation of uh people use editors
00:05:50
in this colour community does not reflect how the global problem community uses editors
00:05:57
and i think that should be kind of a big concern going back to
00:06:01
the question how do we grow the community uh and and it's partly because
00:06:07
learning a new language is really hard unit learned syntax return semantics
00:06:11
i'm a bit learning a new language and menu editor with
00:06:15
all of the short cutting key bindings and everything is even harder
00:06:19
um and and this pretty much reflects how i started it's colour i started reading selling two thousand fourteen and i use the
00:06:26
flips from for quite a few months and and and i i chose that because i was familiar with the clips from java
00:06:32
any tips work right i learn scour uh was able to actually do a play at like the person read it
00:06:39
um and then eventually i switched intelligent uh because well it provided a
00:06:43
more feature rich experience um but what's really interesting is i switched intelligently
00:06:48
i didn't have to vance colour i was already familiar with that out of the box experience of using something that's
00:06:54
familiar so you can learn scholar faster i think is is one of the key components if you wanna grow the community
00:07:01
a student so few years go on um in two thousand i think i've actually started using
00:07:06
full time now obvious code uh with metals and and that's what i'm gonna be presenting today
00:07:12
it's now we can go back and talk about completions and her son and all
00:07:15
of the stuff that that this talk is really about it so i'm a quick tour
00:07:24
uh metals works with current leave officially supports five editors which means that
00:07:29
that's what we document our website works with the us call them emacs
00:07:35
adam and the button text so it works with any other language server compatible editor
00:07:40
but these are the ones that we have tested validated even at maybe some customisations
00:07:44
to really improve the user experience in these matters um and if you're using since last week or actually since the
00:07:51
official release last night from too much and we autumn off officially support all of these four build tools as well
00:07:58
meaning that if you just open up models and up workspace that has any of these build tools
00:08:03
it'll do all the installation automatically for you you don't even have to go online to the website
00:08:08
it just click of a button importers build any works so
00:08:13
and then once you've installed it it has a ton of functionality so all uh i'm not gonna go through all of this list here
00:08:20
so i'll just do a very brief them all just to give you a taste
00:08:26
so um what i have here is the the uh
00:08:31
uh metals and his coat open up in the aqua repository or and
00:08:39
some of the first things you'll see is there's um outline view here
00:08:42
you can walk through an and browse the classes you can fold some cold
00:08:49
and
00:08:52
you have completions and then we have some other fancy features like exhausted matches
00:08:59
and um
00:09:02
so that's pretty cool um and then i may show you uh we also show if
00:09:08
you hover over you get really nice information about the types um and i i think
00:09:14
this one is really helpful we show two parts one is the expression type which is
00:09:17
the type of that expression and and it's highlighted but it's a bit difficult to see now
00:09:22
we'll show you the generic signature of the method that you're
00:09:25
calling 'cause i think both both pieces of information really helpful
00:09:30
and and so if you if you hover over method that has some talk strings will also
00:09:34
give you a nicely formatted a doctor example or thank you
00:09:39
um and that we're suppose for german first column a and yeah you can go definition
00:09:45
you can find references and there i just clicked on and i found five hundred
00:09:48
thirty references to new symbol it was not at all cash uh we try to
00:09:53
the very fast with front references and so uh i just briefly another kind of out
00:09:59
of the box experience how it works i have another installation obvious code here that is um
00:10:06
has no extensions at all installed open up the just disqualify linen they'll build and
00:10:12
what happens is that it pops up and says and i can help you with uh this colour file extensions
00:10:18
and there are quite a few we don't have somebody don't yeah so we're not at the top yep um but if you install it um then them
00:10:27
everything should follow from there
00:10:29
fig open up discovered file
00:10:32
and it takes a moment for the server to start and uh oh yeah i had
00:10:38
already maybe in part of the builder so everything should just worked off of yeah right
00:10:43
um but you would have prompted me to impart to build a which is a male build
00:10:48
so let me see here so let's see that yeah right then
00:10:54
i give you a taste of how metals looks like
00:10:59
or
00:11:04
so as you saw there's a lot of features over fifteen twenty different features and i'm
00:11:09
not gonna go enumerate every one of them and and and show you how they work instead
00:11:14
i think it's more interesting to focusing go more in depth on two topics
00:11:19
so the first one that we struggle with and that was the first feature that you that we have to implement was diagnostics
00:11:26
and they are the red and the the yellow warnings we goals bad it telling you that you haven't here um
00:11:33
and the challengers to get them fast and and and have them relevant like we
00:11:37
should be helping you um and then the second case that you be doing completions
00:11:42
so uh also giving them low latency um but also
00:11:47
support them and you know a large number of positions
00:11:51
let's start with the errors um as you can see here we're kind of
00:11:56
shuffling between a file that doesn't parse and file that has a type there
00:12:03
piper says number should be of type string but it's actually in it
00:12:07
and and we answered the the string interpreter we're missing a closing curly brace
00:12:14
and essentially what this case studies about is just to to how we
00:12:20
tackle this problem of trying to provide these errors so that they're helpful
00:12:25
uh but um but do it fast in a fast
00:12:29
way um so there are two approaches actually do diagnostics
00:12:34
and i i would say one of them is you can just publish them from whatever you compile you run could be compiling you
00:12:40
belittle and then you scrape the logs and you put it into the editor and that's what i would call publishers from the bill tool
00:12:47
i'm an an an an alternative approaches that you have a presentation compiler like a library p. i.
00:12:53
where you do that compilation yourselves in the added in the i.
00:12:56
d. e. and you you you publish them directly yourself and the
00:13:01
the presentation of fire approach is pretty much the industry standard uh
00:13:06
it's used right holidays quality type script java language servers and so
00:13:12
models uses the one from the bill tool uh so
00:13:17
i'm gonna explain why we do that and why i think it's actually has really nice properties um
00:13:23
so in a nutshell when you type compiling s. p. t. it's gonna run compiling hundred twenty eight source files and then
00:13:29
give you an air because you have some problem and what metals there's a just
00:13:33
take that there was evident your editor uh and this has a very nice properties
00:13:40
it's essentially correct by construction whatever you have in your build
00:13:44
that environment is perfectly reflected in your editor there's never the case where
00:13:50
something like a dependencies off sync or anything uh because it's the same thing so if you're using you know
00:13:57
um and i'd scripts which which channel a different built all well we should get the air is directly from that source
00:14:03
uh instead of trying to reproduce that environment if uh and another one which i think is really exciting as
00:14:10
well is that because we perform that batch compilation so
00:14:13
frequently um we can share with your tests when you're running
00:14:19
so you as you're editing you're performing the c. p. u. cycles that are needed for you to run tests
00:14:26
anyways so whenever you go from your endurance your terminal you don't spend any moment compiling 'cause it's already compiled
00:14:33
so i think these two key components make their published like nothing from the build really appealing and and you um
00:14:41
and the first thing that you would expect wise doesn't everyone do this it sounds
00:14:45
fantastic well you get slow feedback as you're editing it may not be as interactive
00:14:52
and another downside as well is that you need to save the file
00:14:56
because the contents that you're editing it to be visible to the bill to
00:15:03
so let's tackle one of those two you know both of the the
00:15:06
downsides slow feedback it requires file save i'll start with the slow feedback
00:15:12
so having looked at this a bit and and we were looking at how to speed things up
00:15:17
the first lesson that we learn was publishing airs is pretty fast you essentially run that pipeline and
00:15:23
you the errors come streaming from the bill to let me just put them straight into the editor
00:15:28
um or is as fast as the bill can be yeah but another the one of the challenges
00:15:34
that removing them knowing that that that that are here is on can be a bit slow all um
00:15:41
so we're gonna look specifically into that how do you clear it so imagine that
00:15:44
we have three source files a. b. and c. and and eighty hasn't here before
00:15:51
and you run the batch compiler and and it runs in faces so it'll run the parser
00:15:56
phase and all three files and then rinse the type or face which is usually the expensive one
00:16:00
then advanced twenty more faces and then eventually you will reach the j. v. m.
00:16:05
and and let's everything's exceeds perfectly we know hey there are no more problems in this file then we can share it
00:16:14
and and that's kind of the naive approach if you say okay let's clear the air is you
00:16:17
have to wade through these all of these faces to finish problem files and that's a bit difficult
00:16:24
so uh what you could do instead is to start group the errors by the faces
00:16:31
that they're published in and then i just publish it after the parser faces finished um
00:16:37
which gives you a bit faster feedback but you know um
00:16:44
user pass or fail but but again you you're still waiting for the type or face to finish all of the sources before you can clear
00:16:51
so essentially is that what you could do is you can group years by whatever facing unit the finish
00:16:57
uh they pair from and and then you clear once those are finished
00:17:01
and this approach is implemented in loop so this is not implemented metals
00:17:06
uh but it's one of the key components that really sped up that you fix that air and it gets removed
00:17:12
and and this was a huge improvement i think in the user experience um and
00:17:18
was really great so metals communicates with loops through the
00:17:23
bill server protocol uh intelligent also has a client implementation
00:17:28
um and you can plug in any other build all that you weren't um
00:17:34
which i think is really great because it's accessible so people are using baylor pounds you could plug in another bill too
00:17:39
but also keep in mind that some of that custom work in terms of providing faster feedback that will
00:17:45
need to be implementing those bill tools as well that maybe gives you feel of of how metals works um
00:17:52
and and one thing that we did two two it was like a very cheap when in terms of giving you
00:17:58
faster feedback was we only probably just look at that
00:18:02
we can use like the presentation compiler approach for syntax errors
00:18:07
so you can run a parser you don't need to know the class pass you don't need to know any of the dependencies are the bill pipeline
00:18:13
and if there's a missing you know closing parentheses around and close
00:18:16
string literal we can just publish those right away um and as you
00:18:21
can see there's a typewriter below which was published from the bill tool
00:18:24
the the trick that metal does models that says that is able to
00:18:28
work really well with an old snapshot of a file that has a diaper and then we get new syntax errors and then we have to compute
00:18:35
hell they align into the new file um and what together working you're able
00:18:40
to get pretty snappy feedback as you're typing while keeping very stable type errors
00:18:45
so uh i think this also helps a lot with the slow feedback so i mean i'm
00:18:50
not gonna claim it's a solved problem uh it's probably still slower than what you used to but
00:18:55
for me personally in the project i'm working are which are small
00:18:57
to medium size it's pretty good and it has was really nice
00:19:03
attributes of crackers by construction insured compilation run and test so let's look at the last
00:19:08
piece which is requires file save so if you just typed in this thing and your buffer
00:19:15
which is an invalid program it has the specs a string that gets in it it should be an error but there is no air in the other
00:19:23
because you have to press save and then you get an or if you're coming
00:19:27
from an editor like clips or from tele today and this maybe you know big counterintuitive
00:19:35
and and what you can do is that's effects that are and and the air is still there well it's there because you haven't saved yet
00:19:43
so i i've seen that these people like that that out of the box experience opening of metals and like
00:19:48
well it's not what i expected it to be um having worked with that now myself for a few months
00:19:57
i'm no longer sure if it's really a feature or bug because
00:20:01
when you press save it triggers that type checking which is expensive it controls your c.
00:20:07
p. u. um and having control over exactly when that happens because you're editing you kind of
00:20:16
you're obviously adding an invalid problem otherwise you wouldn't be adding in the program
00:20:21
so most of the time it's broken anyways and most of the
00:20:24
time you know what's broken so uh i find the work flow where
00:20:28
you can just type without being distracted by moving errors chi you finishing
00:20:33
something is saying hey this is wrong and or a like an identifier
00:20:37
uh is relief nice i think in metals that you can just type it at
00:20:41
yours pays maybe you take a sip of coffee and and nothing's going crazy now
00:20:46
and then when you press a when you wanna get here um and and so i just recommended give it a
00:20:51
try but i just take the liberty to flip the downside into an upside and say it's a feature i saw it
00:21:02
so um that's that's a story around diagnostics and and there's more to it
00:21:06
but i think these were the ones that were kind of interesting and worth sharing
00:21:10
uh and the second one is is a feature that i think everyone
00:21:13
care deeply about completions uh so i've been working on models i think for
00:21:19
seven months and i wasn't using it for my data developmental still using intelligent
00:21:24
um because we were missing completions but uh once we had
00:21:28
completions along with parameter heads which are the ones that show you
00:21:31
the parameters that you're filling in and also being able to show the types of these all three came together in one release
00:21:39
and i was able to switch and i haven't really even had the urge to go back for a
00:21:43
lot of reasons um mostly because they're just really good rather than the really fast like fast so um
00:21:52
i'll explain how how how we do that so we use a presentation compiler approach so as i mentioned
00:21:57
before we use the bill tool for the air is good for the completions we run around presentation parlour
00:22:04
we need to know all the class pass and we need to reproduce that compilation but we have the
00:22:08
liberty of not having to publish any errors we can
00:22:11
do whatever we like 'cause giving you completions like false
00:22:16
like not giving you completions 'cause there's an air is not the end of the world um so so that approach works really great here
00:22:23
and i remember one before i started working on models i heard everyone talk about the presentation compiler does
00:22:29
like where do i had where we depend on this library and i didn't look and they didn't even
00:22:33
know what a classes colorado use it and there were no documentation that was no website about it so
00:22:39
if if you're curious it's a class called skeletal
00:22:42
fantasy interactive that global which extends the sour patch compiler
00:22:47
uh you can depend on it by depending on this colour compiler uh artifact
00:22:52
and it's used by the rebel i'm a grapple this
00:22:56
collide yeas colour fiddle um a lot of other tools
00:23:02
and it implements essentially two kinds of conditions one of them is the scope compilations where you just
00:23:07
pull out an identifier that's already imported in scope and number completions where
00:23:11
you would do a dog and a list of the members of that type
00:23:15
um and as i said before i've just been really pleasantly surprised at that
00:23:19
it's that way and it provides just really reliable member completions in scope completions
00:23:25
but for that reach completion experience
00:23:30
that i was used to intel a. j. school completion remember conclusions were not enough well i need what what
00:23:36
i was missing was quite a few other competitions and that's what metal it's implements on top of the presentation binder
00:23:44
so i'm gonna go through quite a few of the pieces and that we do to kind of make that experience which are
00:23:50
uh and the first one highlights also that it's not that
00:23:53
the presentation compiler should really even have these features because these features
00:23:58
require an editor 'cause you performers factory things we can explicitly move the cursor there's all sorts of
00:24:04
things that wouldn't really would that would be really difficult to encode in the library a. p. i. of the presentation
00:24:10
combined are essentially just gives you a list of symbols and it's up to us to figure out what to do
00:24:15
the first one is when you press enter and you select an item
00:24:19
um you can say this is the refractory should perform on the document
00:24:24
and one of the things that you can do is you can have sniff it's so which is essentially say
00:24:29
it shouldn't start opening parentheses move the cursor inside of the parentheses when you finish that you should trigger
00:24:35
parameter it's that's what you see when you select a greater which is another method
00:24:41
it should have any parentheses and you select filter it moves the cursor into that
00:24:46
filter parentheses and when you select next it knows that there are no arguments it moves the cursor at the end of it
00:24:53
so it's pretty basic but it's still kind of an important come piece of that dated experience of writing code
00:25:02
so one of the fancy features that we have is exhausted match completions
00:25:07
if you do a match completion it'll provided to say just a regular
00:25:11
match or an exhaustive match what we do is this works for um
00:25:18
uh both seal types as well as not seal types which
00:25:22
is different if you're coming from ontology so if you have
00:25:26
a seal type still baby tee it works for both whatever you haven't scope but it'll also work even if those
00:25:32
and nana sound even if they're not in in the the scope
00:25:36
we would out important for you which is what you would expect but
00:25:40
if it's not a sealed eighty t. if it's just like an exception
00:25:43
we will uh not would be don't exhaustively much all of that um
00:25:48
sometimes of exceptions but um i i yeah i'm sorry i forgot to be we give you all
00:25:55
of the exceptions when you do the case completions so i'll just jump into the next one so um
00:26:01
one thing that we do here which is really nice as well is that not only exhausted matches
00:26:06
but individual case statements and i think this is really a feature that i never had an intelligent and
00:26:11
i i really injury models is that you're doing a collect and you're just taking one of the cases
00:26:16
and this is the one that works with both seal types and also for exceptions 'cause
00:26:21
it would just provide you the completions or one of the exceptions that you haven't scope um
00:26:26
um i find this to be really useful um and another polish is
00:26:31
just a small thing but it's one of these things that required a
00:26:33
bit of of thinking was that if you have tasted need and we
00:26:37
know that none matches the type of the qualifier about match so we'll
00:26:43
sorted out the top but we don't filter out the rest because it might be that you wanna do nail dot something else are we it's
00:26:49
really that would be inexpensive analysis the just the sorting is customised and
00:26:53
tweak them polished and so the next one which i was desperately missing which
00:27:00
uh was over reading methods implementing something from an interface
00:27:05
um and in metals you can do that one method at a time you go into
00:27:08
the body like the template of that class here extending seek which has like five hundred methods
00:27:15
yeah but only three of them are abstract so when you do the iterate or you can see that the interior
00:27:20
sort of the the top because that's the one that we should implement first uh but then we go back
00:27:25
and and then there it's all the the concrete once and we automatically know that should be over a keyword
00:27:30
um and we also compute the correct kind of it's a c. given
00:27:34
so then it should be a room filter within it to hold and um
00:27:41
the next one which is a very important features well and it's really saving a lot of keystrokes is
00:27:45
oh i'm gonna need to access that a. p. i've paths um and as you can of surveillance or a an import
00:27:52
at the top so if you if you come from and holiday you take it for granted
00:27:55
it just works perfectly um but this is not part of the presentation compiler so we um
00:28:03
i had to implement it ourselves and the way we insert
00:28:06
the imports is nowhere near as sophisticated as intelligent as it
00:28:10
we just take that symbol only imported at the bottom of the global
00:28:14
import list so you will have to manually go up there and sort them
00:28:19
according to become edges of your project a really nice does all that on the
00:28:22
road that we just it's it's already really good as it is a better than nothing
00:28:28
so the next step is that you do and i think this is the piece that i cared a
00:28:31
lot about because i hate on it all the time is that you have conflicting names you have files
00:28:35
already imported but you wanna use another a. p. i. which also has
00:28:38
the name files because library developers use the same names all over the place
00:28:44
uh and it's really frustrating if files would only show was the file that is in scope metals
00:28:51
always does a full search on the whole thing every completion is exactly the same when we wouldn't
00:28:57
filter out something and there aren't any smart completions that you have to do with another shortcut to
00:29:02
get these results it's just a single command complete we do the full search so if you're gonna do
00:29:09
calm go go while files we know well hey this is already a consequence symbol
00:29:13
in school will just fully qualified for you and i find this really nice um
00:29:19
so another conclusion that we do which i from the
00:29:23
kind of scope a number completion prospective makes no sense
00:29:28
is that you you wanna do a school completion on the code as if it's written inside of a string literal
00:29:34
um so this is kind of a cue thing it didn't take a lot of work to do to implement but you have to
00:29:40
i understand that you're inside of a string literal you have to do your own parsing to
00:29:43
figure that's of the identifier you pull out the scope of that code identifier in the new
00:29:48
you you figure that and then you have to perform the restructuring to insert the
00:29:53
the u. d. u. leading ass and also you have to skip to my dad
00:29:56
of characters in the string and and sometimes you have to put the curly braces
00:30:01
uh and then once you have the argus you can also select the member which was just done the same
00:30:06
way that i think this one my favourite features to implement it was a lot of fun um and very useful
00:30:14
so
00:30:16
you seen all the features now um and there are more but but i think these are the ones that are most interesting
00:30:23
so a lot of customisations um on the feature adding more
00:30:27
richness but we also added a few customisations to try to
00:30:30
squeeze out as much performance as we could because its latency sensitive as you're
00:30:35
typing you wanna get the feedback as fast as you as possible so these are
00:30:40
i would play in the biggest contributors to having decent performance if you're gonna do completion
00:30:46
with the form of the presentation power um i will go through each of them individually
00:30:51
so if you beers a benchmark doing
00:30:55
it's actually a six thousand line file uh doing completions
00:30:59
on on um i'm a member will do dot and um
00:31:05
no the first line is essentially we just did a new
00:31:08
presentation compiler would just gave it to full class pass from zero
00:31:13
and it does that completion uh with a hop j. v. m. so that does ninety milliseconds so if
00:31:19
you just keep around that compiler instance and then you do another completion an a in in a different file
00:31:27
um then it will be forty milliseconds so you
00:31:32
shave off fifty milliseconds just by reusing that compiler
00:31:35
so this seems like you know a no brainer when um but you also have to be careful that the longer you use it
00:31:44
the more symbols get added to the symbol table and you it's likely that you make it more more wrong results
00:31:49
so it's a kind of a delicate balance between trying to reset it um
00:31:54
and reusing and what happens usually is that you get requests in bursts like
00:31:58
five completions in roll all in the same source files to parameter hands three hovers
00:32:03
uh and then we reuse but then metals very aggressive that reciting it again and again and again um but
00:32:10
it really says the most of the requests were able to shave off those fifty millisecond overhead which is significant
00:32:17
uh another i'd say biggest contributor to being also robust and uh and performance is that
00:32:24
and so it's collagen have compiler plug into this p. t. it's by ad compiler plugin
00:32:29
and people have lifters workroom over all sorts of stuff um metals essentially
00:32:35
has a white list is to approved component reckons if you're using kind projector
00:32:42
we'll out if you're using better melodic far we're about to using any other plug in
00:32:48
sorry we disabled it
00:32:52
so if you have a so and it's from the observation
00:32:56
the most compatible is actually don't change the semantics of the language
00:33:01
so these two actually introduce new like if if
00:33:04
you wouldn't have kind projector the conclusions would break
00:33:08
if you don't have bred a better manic for they would also breaking where grace a bit less obvious
00:33:13
ways so we disable everything else including macro paradise so
00:33:18
micro paradise also qualifies for the changes the language semantics
00:33:22
but it also transforms the trees that we get so much that all of the positions are broken
00:33:28
so the completion don't work anyways if ah and then uh
00:33:34
you may be wondering now on using come back rotations my project does that mean
00:33:38
it's totally broken and that's not at all the case that's really cool observation is that
00:33:43
if you have my connotations in a project the conclusions were totally fine with them the whole we'd don't work if you have
00:33:50
an annotation in a source file and you're trying to complete in the same source file
00:33:55
for those numbers so if you have another project or any other another
00:33:59
separate file or their expand that they will appear in your conclusions it's only
00:34:04
if you're in the same file uh but that wasn't your trade off because
00:34:08
you missed a few completions in that case but if we enable that you'd miss
00:34:12
almost all of them anyways because the trees are broken anyways so that was kind of
00:34:18
how we ended up another one that we do is is we actually disable black box macros we don't expand them
00:34:25
and and this saves from some benchmarks in like a source i with two hundred
00:34:28
lines very small on doing some fast course parsers and i was able to shave off
00:34:33
around hundred and thirty milliseconds if i remember correctly by just turning them off uh and
00:34:38
if you're not familiar with box markers there is actually some code where you you right
00:34:43
let's say here you wanna generate the time stamp up the compilation time so what happens is that the compiler will
00:34:50
invoke this call it well executed at compile time and put in a new syntax tree based on what you expanded
00:34:58
and just observe here that the it returns along the tree but it's annotated doesn't any
00:35:05
um i'll explain that in just a bit but we like what macros have this really nice
00:35:12
via attribute that you can disable them and they don't affect completions in anyway
00:35:17
so the completions are totally accurate even if you discard them you just getting
00:35:22
a hundred fifty millisecond shave after your type checking which is awesome um there's
00:35:27
another flavour macros that are called white box and there's no way we like
00:35:30
if we disable then we would produce incorrect results and i'm just gonna briefly explain why so if you're right
00:35:36
if you have the original colour which would be something markers dot times up if it was a black box micro gets expanded into the tree
00:35:43
but because the method hasn't any type description the expansion and then we'll wrap ascribe that expression to any
00:35:50
so um you it doesn't leak that it was a long but
00:35:55
uh why possible not to do that type script type description meaning
00:35:59
that the x. will have the type long meaning than the type of x. will influence the completions the rest of the source file
00:36:06
so this means if you're using models with colour remake shapeless that has h. least generated by macros
00:36:12
uh you will get the correct h. list from like a person with the initiative string in it than a journal
00:36:18
um but just keep in mind that you're paying also for the cost here
00:36:24
um another big when is just by not doing something requests of all that's an even
00:36:30
better you confirmed to down to zero um so imagine that we have a request queue
00:36:37
uh probably been moving my hands in the wrong direction the whole time 'cause they're
00:36:41
the screen here is wrong but anyway so the request you goes this way and we're
00:36:47
responding to the the first completion here and in the meantime well there is money
00:36:52
to the other senses three new uh completions um once we're finished with the first completion
00:37:01
we cancel the two that are older and we start working on the latest completion
00:37:07
uh and this was only chains now in the last release that was coming last night in the sense that we previously we would
00:37:13
respond to them in order and what we could have this getting up like a relaunch you of requests and you wouldn't get feedback
00:37:20
now we just prioritise whatever you just submitted and that makes sense in
00:37:24
a world where you're editing you only care about the last completion that
00:37:27
you triggered not the one that was before and this is great because we shave off like we should be skip a bunch of requests um
00:37:36
and what we can do is well is the editor can
00:37:40
send us cancel this and so even in while is in progress
00:37:46
uh metals if the other tells us cancel this we will be able to turn of an even stop the type checker
00:37:51
during middle of type checking thanks to the cancellation supporting the compiler that that's really great
00:37:58
and the last piece is a feature that is just implemented in the
00:38:02
compiler in the presentation the binder or you can instead of type checking all
00:38:06
source file you can give it a position and it will just type check down to that position and you get the types tree at that position
00:38:14
so here just as an example we're doing we're completing numbers and that means we need to common type checked the object models
00:38:21
we get numbers but it's as a type description list of it so we don't have to type check the one in the
00:38:28
the body of that method and so this works out of the box if you just use the presentation opener
00:38:33
for scope and i'm a member completions but but all
00:38:37
the customisations extensions that we do with actually we need
00:38:40
to work a lot with the compiler trees and they're half height checked so if you're working on the code
00:38:46
base you come in you need to be aware that it's really easy to have a node types on some trees
00:38:51
and you need to be aware that yours should use just targeted type big and and and that's pretty
00:38:56
much all models does now and it means it makes a huge difference i don't have any numbers but
00:39:00
for the parameter hands uh it went from just like oh i i wanna i don't wanna do
00:39:05
prominence 'cause it was so slow to the point where it was just always there and i didn't bother
00:39:10
and so that makes it made a huge difference um so as i said before models as a lot of features and we had
00:39:19
to um to cover two case studies of diagnostics and completions there's a lot more to
00:39:26
it so feel free to come to me and and asking the questions if you're curious
00:39:31
and i'm gonna just very quickly go over the others that we support
00:39:36
but it'll be a bit fast since i i don't have so much time left um
00:39:42
if you're wondering what's up with the hyper on visual studio code i'll give it you know in in a minute so
00:39:49
it has really great support for other languages that are very widely used primarily type scripting playful like it's fantastic
00:39:56
sophie using those languages committees collect you probably wanna just continue using these code
00:40:01
it has i was piece of work out of the box which means that it's
00:40:04
just built into the editor and the view school team maintains that support which is great
00:40:09
um i'm gonna show i don't think i'll have time to show you but i wanted to show you a there are two
00:40:14
features called life share an remote development which are just fantastic
00:40:18
it allows you to per problem with the remote caught code collie
00:40:21
and you're just editing as if you're on the same computer in the cool drive style
00:40:25
collaboration uh and it's fantastic remote development allows you to s. s. h. into the remote machine
00:40:32
i know as in your obvious coding you just say on open up a folder in an s. s. h. remote
00:40:38
and then you just editing on that machine that you have the grade you why would
00:40:42
know fiddling with file watches or anything just works out of the box and it's fantastic um
00:40:49
it has a great extension ecosystem and having written worked a bit on the metals
00:40:53
extension that we've ridden type script as well and i just enjoy writing
00:40:57
the extension it takes me like you have good completions apart you press play
00:41:03
you get like a new fresh instance in two seconds that has that version of whatever you change so it's really snappy in great
00:41:09
and i've tried to do it with the the other editors is just the best i've seen interviews code
00:41:14
um and it's very actively developed like every month there new releases and
00:41:18
i'm i look forward to reading the release notes because it's just something exciting
00:41:23
so the only really bad thing i can say is that the
00:41:25
syntax selling first colour kind of socks uh it's going way better
00:41:30
thanks to a contributor compare now for the past weeks and i'm just so thankful to woodward because
00:41:38
ah previously was is especially batter oh string interpreters
00:41:41
um and non ascii identifiers and stuff like that
00:41:45
it's so i'll mention just as good this because the time is out um uh that life sure um
00:41:53
is really cool so give it a try and the role the remote development where
00:41:57
you can use as you know you can code on a machine with a hundred course
00:42:02
and two hundred gigs of ram and it just works seamlessly there's no it's like you
00:42:06
just do it from the us code you why it's fantastic to give it a try
00:42:10
um so for them it's legendary model editing i've used it
00:42:15
myself for python development for a while and i love that uh
00:42:20
it has i'm just gonna say it wasn't the case a year ago but to date has a comprehensive list the support in fact
00:42:27
or two different implementations like two different and plug ins the comprehensive
00:42:32
implement most of the spec which is just fantastic um and i'd say
00:42:40
the biggest complaint i can have having tried to use it now with metal says that
00:42:45
if you wanna say hey would you like to import the build that is a blocking u. i.
00:42:49
widget would be really nice to just have a thing that's on like non blocking on the side
00:42:54
and you can continue editing a click on the button whenever you want and
00:42:56
and this is really really annoying uh and if you haven't seen it there's an
00:43:03
in development i don't recall only been which kind of solves that problem but
00:43:07
still keeps all the goodies of him so i'm personally reciting about that one
00:43:12
uh emacs i don't know much about so don't shoot me
00:43:16
but it seems to be legendary customisable uh and it
00:43:21
also not the case a year ago but it has to be a comprehensive list the
00:43:25
support which is just fantastic and uh it supports pretty much all of the features that we
00:43:30
supporting models including the advance parts around completions um
00:43:35
and i would say it's the same issue as of him but probably
00:43:39
some of the signal that's not the case you just need another plugin um
00:43:43
and then if you wanna have like a non blocking you i've aged to do imports it's kind of invasive
00:43:49
and sublime text i've never used really but i have like great respect for
00:43:54
it's primarily because it's legendary lightweight and it has really good
00:43:59
the falls in my opinion um and it's not as comprehensive today is election them
00:44:06
um the l. s. p. package but it actively developed and i think there's an
00:44:09
open p. writing some the more advanced pieces in completions so it's getting there really close
00:44:14
um which makes a very optimistic i think is great i would really we should one text
00:44:19
like that's sensible defaults philosophy is you just have a list the out
00:44:23
of the box and would be a huge boost for for someone an
00:44:27
i just pick one thing i'm sure there are other things but we have commands like import building currently have to like copy paste jason
00:44:34
config every person has to do that there's no way for us
00:44:36
to or maybe there is but i haven't figured out and lastly adam
00:44:42
uh it seems to be legend there next as well um it has
00:44:47
really these nice you averages the same that b. s. code has but
00:44:52
sorry maybe someone is i mean uh the l. s. b. support does not
00:44:57
uh the the completions don't handle some the mormons re factoring so we do um
00:45:00
no i'm not aware of any current p. r. six in these issues so like hello
00:45:05
imports like the imports just don't appear which is really about out of the box experience
00:45:10
not recommend this if you're showing it to beginners and say just install metals news item
00:45:15
like some stuff doesn't work and there's nothing there's no way for us
00:45:18
to to to figure work around that um so that's it so future work
00:45:24
as you can imagine an i. d. is a huge task uh
00:45:29
running and testing and debugging we have my neck who is from versus levels been working on this
00:45:35
full time now for over a month i think and i'm really excited i'm i'm optimistic we'll be able
00:45:40
to have just run and maybe down the road even debugging uh but also run tests and you could see
00:45:46
the passed passed on the field tests and i i'm really excited about that i'm getting close to that
00:45:52
out of the box experience for beginner who was not doesn't even have to know what's colour justices or something
00:45:58
and doesn't have to figure out the yeah with the incantation for just testing the single unit test
00:46:03
it's all of the testing memories of different syntax and winning the symbol
00:46:07
we're pretty much there or was we have find references and a bit requires
00:46:10
a little more custom development to to to be correct i'm re factoring support
00:46:16
is nonexistent at the time uh i lust he has great infrastructure for restructurings
00:46:22
uh but we just don't implement at the moment and it's a big project
00:46:27
i work six i think uh would be fantastic to have if you just open up the file you can see the values in line
00:46:33
well they are as you just learning anyway p. i. and i would estimate this is not even hard to add uh with
00:46:39
our current infrastructure and the same thing is pretty much the
00:46:42
same thing for s. b. t. and and and scholar script files
00:46:46
uh so probably a hundred other features that could be added i'm better
00:46:51
at these are the highlighting ones i think are most exciting thank you

Share this talk: 


Conference Program

Welcome!
June 11, 2019 · 5:03 p.m.
1574 views
A Tour of Scala 3
Martin Odersky, Professor EPFL, Co-founder Lightbend
June 11, 2019 · 5:15 p.m.
8337 views
A story of unification: from Apache Spark to MLflow
Reynold Xin, Databricks
June 12, 2019 · 9:15 a.m.
1267 views
In Types We Trust
Bill Venners, Artima, Inc
June 12, 2019 · 10:15 a.m.
1569 views
Creating Native iOS and Android Apps in Scala without tears
Zahari Dichev, Bullet.io
June 12, 2019 · 10:16 a.m.
2232 views
Techniques for Teaching Scala
Noel Welsh, Inner Product and Underscore
June 12, 2019 · 10:17 a.m.
1296 views
Future-proofing Scala: the TASTY intermediate representation
Guillaume Martres, student at EPFL
June 12, 2019 · 10:18 a.m.
1157 views
Metals: rich code editing for Scala in VS Code, Vim, Emacs and beyond
Ólafur Páll Geirsson, Scala Center
June 12, 2019 · 11:15 a.m.
4695 views
Akka Streams to the Extreme
Heiko Seeberger, independent consultant
June 12, 2019 · 11:16 a.m.
1552 views
Scala First: Lessons from 3 student generations
Bjorn Regnell, Lund Univ., Sweden.
June 12, 2019 · 11:17 a.m.
577 views
Cellular Automata: How to become an artist with a few lines
Maciej Gorywoda, Wire, Berlin
June 12, 2019 · 11:18 a.m.
386 views
Why Netflix ❤'s Scala for Machine Learning
Jeremy Smith & Aish, Netflix
June 12, 2019 · 12:15 p.m.
5026 views
Massively Parallel Distributed Scala Compilation... And You!
Stu Hood, Twitter
June 12, 2019 · 12:16 p.m.
958 views
Polymorphism in Scala
Petra Bierleutgeb
June 12, 2019 · 12:17 p.m.
1113 views
sbt core concepts
Eugene Yokota, Scala Team at Lightbend
June 12, 2019 · 12:18 p.m.
1656 views
Double your performance: Scala's missing optimizing compiler
Li Haoyi, author Ammonite, Mill, FastParse, uPickle, and many more.
June 12, 2019 · 2:30 p.m.
837 views
Making Our Future Better
Viktor Klang, Lightbend
June 12, 2019 · 2:31 p.m.
1682 views
Testing in the postapocalyptic future
Daniel Westheide, INNOQ
June 12, 2019 · 2:32 p.m.
498 views
Context Buddy: the tool that knows your code better than you
Krzysztof Romanowski, sphere.it conference
June 12, 2019 · 2:33 p.m.
394 views
The Shape(less) of Type Class Derivation in Scala 3
Miles Sabin, Underscore Consulting
June 12, 2019 · 3:30 p.m.
2321 views
Refactor all the things!
Daniela Sfregola, organizer of the London Scala User Group meetup
June 12, 2019 · 3:31 p.m.
514 views
Integrating Developer Experiences - Build Server Protocol
Justin Kaeser, IntelliJ Scala
June 12, 2019 · 3:32 p.m.
551 views
Managing an Akka Cluster on Kubernetes
Markus Jura, MOIA
June 12, 2019 · 3:33 p.m.
735 views
Serverless Scala - Functions as SuperDuperMicroServices
Josh Suereth, Donna Malayeri & James Ward, Author of Scala In Depth; Google ; Google
June 12, 2019 · 4:45 p.m.
936 views
How are we going to migrate to Scala 3.0, aka Dotty?
Lukas Rytz, Lightbend
June 12, 2019 · 4:46 p.m.
709 views
Concurrent programming in 2019: Akka, Monix or ZIO?
Adam Warski, co-founders of SoftwareMill
June 12, 2019 · 4:47 p.m.
1974 views
ScalaJS and Typescript: an unlikely romance
Jeremy Hughes, Lightbend
June 12, 2019 · 4:48 p.m.
1377 views
Pure Functional Database Programming‚ without JDBC
Rob Norris
June 12, 2019 · 5:45 p.m.
6375 views
Why you need to be reviewing open source code
Gris Cuevas Zambrano & Holden Karau, Google Cloud;
June 12, 2019 · 5:46 p.m.
484 views
Develop seamless web services with Mu
Oli Makhasoeva, 47 Degrees
June 12, 2019 · 5:47 p.m.
785 views
Implementing the Scala 2.13 collections
Stefan Zeiger, Lightbend
June 12, 2019 · 5:48 p.m.
811 views
Introduction to day 2
June 13, 2019 · 9:10 a.m.
250 views
Sustaining open source digital infrastructure
Bogdan Vasilescu, Assistant Professor at Carnegie Mellon University's School of Computer Science, USA
June 13, 2019 · 9:16 a.m.
375 views
Building a Better Scala Community
Kelley Robinson, Developer Evangelist at Twilio
June 13, 2019 · 10:15 a.m.
245 views
Run Scala Faster with GraalVM on any Platform
Vojin Jovanovic, Oracle
June 13, 2019 · 10:16 a.m.
1342 views
ScalaClean - full program static analysis at scale
Rory Graves
June 13, 2019 · 10:17 a.m.
463 views
Flare & Lantern: Accelerators for Spark and Deep Learning
Tiark Rompf, Assistant Professor at Purdue University
June 13, 2019 · 10:18 a.m.
380 views
Metaprogramming in Dotty
Nicolas Stucki, Ph.D. student at LAMP
June 13, 2019 · 11:15 a.m.
1250 views
Fast, Simple Concurrency with Scala Native
Richard Whaling, data engineer based in Chicago
June 13, 2019 · 11:16 a.m.
624 views
Pick your number type with Spire
Denis Rosset, postdoctoral researcher at Perimeter Institute
June 13, 2019 · 11:17 a.m.
245 views
Scala.js and WebAssembly, a tale of the dangers of the sea
Sébastien Doeraene, Executive director of the Scala Center
June 13, 2019 · 11:18 a.m.
661 views
Performance tuning Twitter services with Graal and ML
Chris Thalinger, Twitter
June 13, 2019 · 12:15 p.m.
2003 views
Supporting the Scala Ecosystem: Stories from the Line
Justin Pihony, Lightbend
June 13, 2019 · 12:16 p.m.
163 views
Compiling to preserve our privacy
Manohar Jonnalagedda and Jakob Odersky, Inpher
June 13, 2019 · 12:17 p.m.
302 views
Building Scala with Bazel
Natan Silnitsky, wix.com
June 13, 2019 · 12:18 p.m.
565 views
245 views
Asynchronous streams in direct style with and without macros
Philipp Haller, KTH Royal Institute of Technology in Stockholm
June 13, 2019 · 3:45 p.m.
304 views
Interactive Computing with Jupyter and Almond
Sören Brunk, USU Software AG
June 13, 2019 · 3:46 p.m.
681 views
Scala best practices I wish someone'd told me about
Nicolas Rinaudo, CTO of Besedo
June 13, 2019 · 3:47 p.m.
2707 views
High performance Privacy By Design using Matryoshka & Spark
Wiem Zine El Abidine and Olivier Girardot, Scala Backend Developer at MOIA / co-founder of Lateral Thoughts
June 13, 2019 · 3:48 p.m.
754 views
Immutable Sequential Maps – Keeping order while hashed
Odd Möller
June 13, 2019 · 4:45 p.m.
277 views
All the fancy things flexible dependency management can do
Alexandre Archambault, engineer at the Scala Center
June 13, 2019 · 4:46 p.m.
389 views
ScalaWebTest - integration testing made easy
Dani Rey, Unic AG
June 13, 2019 · 4:47 p.m.
468 views
Mellite: An Integrated Development Environment for Sound
Hanns Holger Rutz, Institute of Electronic Music and Acoustics (IEM), Graz
June 13, 2019 · 4:48 p.m.
213 views
Closing panel
Panel
June 13, 2019 · 5:54 p.m.
400 views

Recommended talks

Exploring Scala Tooling ecosystem
Jeferson David Ossa, Colombia
June 14, 2019 · 3:12 p.m.