SlideShare ist ein Scribd-Unternehmen logo
1 von 52
Microservices for building an IDE
The innards of JetBrains Rider
Maarten Balliauw
@maartenballiauw
JetBrains Rider
demo
Rider
Cross-platform, full-stack .NET IDE
All languages, all frameworks
Even WinForms (on Windows)
Rider C++ in preview
Lightweight, fast & yet a full IDE!
Built on IntelliJ IDEA and ReSharper
Helps you be more productive as a developer
Free trial! https://RiderIDE.net/maarten
History
JetBrains
Founded 2000 in Prague (Czech Republic)
2000 IntelliJ Renamer
2001 IntelliJ
2004 ReSharper
2020 20+ IDE’s and other developer tools
ReSharper IDE
Project was halted (but not gone to waste)
Keep functionality separate from the actual IDE
Same core, IDE interoperability layer on top
Visual Studio 2010, 2013, 2015, 2017 and 2019
ReSharper command line tools (CLI)
Several concepts and architecture remained
“When will JetBrains come
with its own .NET IDE?”
Why build a .NET IDE?
In 2017…
“When will JetBrains come with its own .NET IDE?”
ReSharper constrained by Visual Studio environment
32-bit process resource constraints
Changes in VS impact ReSharper
.NET Core
No good and consistent cross-platform IDE
Cross-platform...
...means a cross-platform UI toolkit is needed!
ReSharper UI built with WinForms and WPF
Existing ReSharper UI would need converting
WinForms? (Mono sort of has it)
GTKSharp?
Qt?
IntelliJ Platform
Foundation of all of our IDE’s
Project view, code completion, UI toolkit
+ Platform plugins such as version control, terminal, ...
+ JetBrains <product name> IDE plugins
Open source (build your own IDE – e.g. Android Studio, Comma IDE & others)
https://github.com/JetBrains/intellij-community
Windows, Linux, Mac – already cross-platform thanks to JVM
IntelliJ Platform + R# ?
IntelliJ Platform
Great foundation to build on
Windows, Linux, Mac
JVM
ReSharper (R#)
All of those .NET inspections, refactorings, code
generation, project model, ...
.NET
Options!
Rewrite R# in Java?
16 years of implementation and knowledge
Would bring 2 R# implementations... Automatic conversion?
Run R# as a command-line process
Already possible (thanks, 2004!)
“Just need our own UI on top”
IntelliJ Platform + R# !
Headless R# as a language server
Cross-platform (.NET on Windows, .NET Core on macOS/Linux)
No constraints
It is ReSharper! 2 products, 1 code base
IntelliJ as a thin UI
Control the R# process
Both sides are an IDE...
Is IntelliJ IDEA really a thin UI? Three sorts of features...
IJ handles everything
R# handles almost everything
Both IDE’s make a more awesome IDE
1 + 1 = 3
demo
How to make them talk?
Inter-process communication
Example: Context actions (Alt+Enter)
IntelliJ
Text editor, caret(s)
Alt+Enter key binding
“Language infrastructure” + C# facade
ReSharper
C# language, inspections, actions
IntelliJ
Render actions, may add own entries
Data: a tree of id, name and icon nodes
1. Bi-directional
User can be typing
A refactoring or completion may be injecting code at the same time
2. Can be implemented with delta’s
IntelliJ pushes delta to R#
R# pushes delta to IntelliJ
Can’t really do RPC (user experience would be bad)
How to handle concurrency?
Data: a delta (from line + column, to line + column, text to insert)
Example: Writing code
Data types aren’t that complex...
Context actions
A tree of id, name and icon nodes
Inspections
A set of name, icon, severity, tooltip, text range
Writing code
Delta with from line + column, to line + column, text to insert
Fairly simple messages! We can make this generic enough!
e.g. make one inspection work  make them all work
Which protocol do we use?
Re-use Language Server Protocol (LSP)?
Great in itself – IDE concepts like window, editor, language, diagnostics, ...
We would need customizations for R# feature set
Or build a custom REST-like protocol?
Experimented with JSON, ProtoBuf, request/response style
Request-action-response
LSP and custom protocol are mostly request/response
Every call needs context (which solution, project, file, location in code, ...)
Realization: Why use this “request-action-response” flow? Why RPC?
Both IDE’s share a similar model and architecture
Messages are simple, but for RPC they would need context
(which solution, which file, state info, ...) – overhead!
Model-View-ViewModel (MVVM)
IntelliJ is our view, ReSharper provides the model
Protocol is the ViewModel, sharing lightweight data
Project.Files.Add("Foo.cs")
Project.Files["Foo.cs"].Inspections.Add(
"Possible null reference", "Warning", 20, 30, 20, 42);
Both processes can react to such change (observable + observer)
Conflict resolution...
Changes to data in shared model can come from IJ and R#
Can still cause conflicts due to features or timing/GC issues
IntelliJ: “I just deleted file foo.cs”
R#: “I just refactored foo.cs”
Solutions!
Locking? (freezes, how to handle deadlocks?)
Conventions!
Conflict conventions!
View + Model (or client: IntelliJ + server: ReSharper)
Each value stored in the view model has a version
Updates by the view/client increment the version
Updates by the model/server do not
Only accept changes if version is the same or newer
If not, the change is discarded
Rider protocol
Obligatory diagram
Ideally, our developers do not have
to know the details of this.
Just create view models.
Rider protocol
“Reactive Distributed communication framework for .NET, Kotlin, JS, C++”
Open source - https://github.com/jetbrains/rd
1. Include protocol libraries
and build tools on all sides
2. Write view model in special DSL
3. Generate code
4. Work with generated model
.NET/Kotlin/JS/... code generator
Model definition DSL
Primitives
Conflict resolution, serialization, ...
Sockets, batching, binary wire protocol
Rider protocol
Only need to know about a few data types & create model
Conflict resolution, wire protocol, timeouts, ... handled by protocol
Code generated based on the defined view model
Bonus points: no reflection/introspection needed on every run
Hierarchical + lifetimes
Primitives
Primitive Description
Signal Event that is fired when something happens
Property Observable value
List/set/map Observable collections
Field Immutable value
Call/callback RPC-style call, needed from time to time
byte, short, int, long, float,
double, char, boolean, string,
securestring, void, enum, ...
Primitives and special types
Aggregatedef/classdef/structdef A node in the viewmodel
Signal (event)
Producers/subscribers
Observable/observer
Using lifetime to manage subscription
// Produceevent
interfaceISource<T>{
voidFire(T value);
}
// Subscribetoevent
interfaceISink<T> {
voidAdvise(Lifetimel,Action<T> handler);
}
// Event
interfaceISignal<T>:ISource<T>,ISink<T> { }
Property
Signal implementation
Lifetime to manage subscription
// Observableproperty
interfaceIProperty<T>: ISink<T> {
T Value{ get;set;}
voidAdvise(Lifetimel,Action<T> handler);
voidView(Lifetime l,Action<Lifetime,T>handler);
}
Hierarchical + lifetimes
Cleanup and resource management
Objects attach to lifetime
Lifetime destroys attached objects
Parent lifetime destroys children
NuGet: JetBrains.Lifetimes
publicclassLifetime: IDisposable{
privateStack<Action> resources
= newStack<Action>();
publicvoidAttach(Actionresource){
resources.Push(resource);
}
publicvoidAttach(IDisposabledisposable){
resources.Push(disposable.Dispose);
}
publicvoidDispose(){
while(resources.Count> 0) {
varresource= resources.Pop();
resource();
}
}
}
Hierarchical + lifetimes
Solution
NuGethost
Project
Document
Inspections
PSI (Program StructureInterface)
Class
Field
Method
Document
Inspections
...
Project
Local history
NuGettool window
Project
Editor tab
Inspections
Language
Editor tab
Inspections
Language
viewmodel(Riderprotocol)
Rider protocol
demo
Rider protocol
Kotlin-based DSL - easy to work with for our developers
Update view model, generate code, work with generated code
Find Usages, Navigation, ... work while crafting model
No need to think about multiple processes, state, conflict resolution, ...
Cross-language, cross-platform
Plugin model for Rider is more complex (IJ and R# parts may be needed)
https://github.com/JetBrains/fsharp-support
https://github.com/JetBrains/resharper-unity
https://github.com/JetBrains/azure-tools-for-intellij
Microservices
Two processes!
Isolation!
Each has their own 64 bit memory space
Also their own, separate GC
Multi-core machines
Start/stop independently
Debugging? Four processes.
Rider (IntelliJ + ReSharper)
Debugger worker process
Your application
Multiple processes...
What if certain features were
running in their own process?
No need to run all the time
Own memory constraints
Start/stop/crash independently
Shared view model
Pass around a shared view model
to interested parties
Example: Roslyn analyzers/inspections
Pass around “reference” of
[
{ name, icon, severity,
tooltip, text range }
]
Shared view model
Multiple machines
Socket-based wire protocol
Sockets can be on multiple machines
Example:
Docker debugging
Remote debugging
Unity game engine
www.unity3d.com
Extension to view model
Rider plugin
Unity editor plugin
https://github.com/JetBrains/resharper-unity
https://twitter.com/kskrygan/status/1064950644094705664
https://twitter.com/kskrygan/status/1064950644094705664
Future
Model the view as well
public CSharpInteractiveOptionsPage(Lifetime lifetime, ...)
: base(lifetime, ...) {
AddHeader("Tool settings");
AddToolPathFileChooserOption(lifetime, commonFileDialogs);
AddEmptyLine();
AddStringOption((CSIOptions s) => s.ToolArguments,
"Tool arguments:", "Additional tool arguments");
AddHeader("Tool window behavior");
AddBoolOption((CSIOptions s) => s.FocusOnOpenToolWindow,
"Focus tool window on open");
AddBoolOption((CSIOptions s) => s.FocusOnSendLineText,
"Focus tool window on Send Line");
AddBoolOption((CSIOptions s) => s.MoveCaretOnSendLineText,
"Move caret down on Send Line");
// ...
}
Multiple machines
WPF on macOS/Linux
Rendering on Windows
Front-end on one machine,
back-end on another
...
Every IDE as both a client and server
Front-end and back-end: separate process & memory
Whatever happens in the backend, the frontend can process the user's typing
Bring this technology to other IDE’s?
Reuse WebStorm's HTML/CSS/JS functionality in ReSharper
(e.g. Visual Studio + R# using WebStorm in back-end mode)
Summary
Conclusion
Rider is an IDE built on
two IDE’s
two technology stacks
Rich and easy programming model was needed to bridge the two
Protocol gave rise to
more than two processes
more than one machine
micro UI
Free trial! www.jetbrains.com/rider
Thank you!
https://blog.maartenballiauw.be
@maartenballiauw

Weitere ähnliche Inhalte

Was ist angesagt?

Wiesław Kałkus: C# functional programming
Wiesław Kałkus: C# functional programmingWiesław Kałkus: C# functional programming
Wiesław Kałkus: C# functional programmingAnalyticsConf
 
Extending Java EE with CDI and JBoss Forge
Extending Java EE with CDI and JBoss ForgeExtending Java EE with CDI and JBoss Forge
Extending Java EE with CDI and JBoss ForgeAntoine Sabot-Durand
 
Code camp 2011 Getting Started with IOS, Una Daly
Code camp 2011 Getting Started with IOS, Una DalyCode camp 2011 Getting Started with IOS, Una Daly
Code camp 2011 Getting Started with IOS, Una DalyUna Daly
 
Android application model
Android application modelAndroid application model
Android application modelmagicshui
 
Android : How Do I Code Thee?
Android : How Do I Code Thee?Android : How Do I Code Thee?
Android : How Do I Code Thee?Viswanath J
 
Rider - Taking ReSharper out of Process
Rider - Taking ReSharper out of ProcessRider - Taking ReSharper out of Process
Rider - Taking ReSharper out of Processcitizenmatt
 
Dependency Injections in Kotlin
Dependency Injections in KotlinDependency Injections in Kotlin
Dependency Injections in KotlinEatDog
 
Creating Great REST and gRPC API Experiences (in Swift)
Creating Great REST and gRPC API Experiences (in Swift)Creating Great REST and gRPC API Experiences (in Swift)
Creating Great REST and gRPC API Experiences (in Swift)Tim Burks
 
Integration of java ee applications on c – based implementations
Integration of java ee applications on c – based implementationsIntegration of java ee applications on c – based implementations
Integration of java ee applications on c – based implementationsAlexander Decker
 

Was ist angesagt? (10)

Wiesław Kałkus: C# functional programming
Wiesław Kałkus: C# functional programmingWiesław Kałkus: C# functional programming
Wiesław Kałkus: C# functional programming
 
Extending Java EE with CDI and JBoss Forge
Extending Java EE with CDI and JBoss ForgeExtending Java EE with CDI and JBoss Forge
Extending Java EE with CDI and JBoss Forge
 
Code camp 2011 Getting Started with IOS, Una Daly
Code camp 2011 Getting Started with IOS, Una DalyCode camp 2011 Getting Started with IOS, Una Daly
Code camp 2011 Getting Started with IOS, Una Daly
 
Android application model
Android application modelAndroid application model
Android application model
 
Android : How Do I Code Thee?
Android : How Do I Code Thee?Android : How Do I Code Thee?
Android : How Do I Code Thee?
 
Rider - Taking ReSharper out of Process
Rider - Taking ReSharper out of ProcessRider - Taking ReSharper out of Process
Rider - Taking ReSharper out of Process
 
Dependency Injections in Kotlin
Dependency Injections in KotlinDependency Injections in Kotlin
Dependency Injections in Kotlin
 
Java basic
Java basicJava basic
Java basic
 
Creating Great REST and gRPC API Experiences (in Swift)
Creating Great REST and gRPC API Experiences (in Swift)Creating Great REST and gRPC API Experiences (in Swift)
Creating Great REST and gRPC API Experiences (in Swift)
 
Integration of java ee applications on c – based implementations
Integration of java ee applications on c – based implementationsIntegration of java ee applications on c – based implementations
Integration of java ee applications on c – based implementations
 

Ähnlich wie Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo 2020

Microservices for building an IDE – The innards of JetBrains Rider - TechDays...
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...Microservices for building an IDE – The innards of JetBrains Rider - TechDays...
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...Maarten Balliauw
 
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...Maarten Balliauw
 
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...Maarten Balliauw
 
Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008Jonas Follesø
 
Whidbey old
Whidbey old Whidbey old
Whidbey old grenaud
 
Code Analysis and Refactoring with CDT
Code Analysis and Refactoring with CDTCode Analysis and Refactoring with CDT
Code Analysis and Refactoring with CDTdschaefer
 
Framework engineering JCO 2011
Framework engineering JCO 2011Framework engineering JCO 2011
Framework engineering JCO 2011YoungSu Son
 
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for DevelopersMSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for DevelopersDave Bost
 
Introduction to Software Development
Introduction to Software DevelopmentIntroduction to Software Development
Introduction to Software DevelopmentZeeshan MIrza
 
Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2Daniel Egan
 
Overview of VS2010 and .NET 4.0
Overview of VS2010 and .NET 4.0Overview of VS2010 and .NET 4.0
Overview of VS2010 and .NET 4.0Bruce Johnson
 
Easing offline web application development with GWT
Easing offline web application development with GWTEasing offline web application development with GWT
Easing offline web application development with GWTArnaud Tournier
 
iOS overview
iOS overviewiOS overview
iOS overviewgupta25
 
The fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose ReactThe fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose ReactOliver N
 
Android Introduction on Java Forum Stuttgart 11
Android Introduction on Java Forum Stuttgart 11 Android Introduction on Java Forum Stuttgart 11
Android Introduction on Java Forum Stuttgart 11 Lars Vogel
 

Ähnlich wie Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo 2020 (20)

Microservices for building an IDE – The innards of JetBrains Rider - TechDays...
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...Microservices for building an IDE – The innards of JetBrains Rider - TechDays...
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...
 
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
 
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
 
Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008
 
Whidbey old
Whidbey old Whidbey old
Whidbey old
 
Code Analysis and Refactoring with CDT
Code Analysis and Refactoring with CDTCode Analysis and Refactoring with CDT
Code Analysis and Refactoring with CDT
 
Csharp dot net
Csharp dot netCsharp dot net
Csharp dot net
 
Html5
Html5Html5
Html5
 
VB.Net Mod1.pptx
VB.Net Mod1.pptxVB.Net Mod1.pptx
VB.Net Mod1.pptx
 
Framework engineering JCO 2011
Framework engineering JCO 2011Framework engineering JCO 2011
Framework engineering JCO 2011
 
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for DevelopersMSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
 
Introduction to Software Development
Introduction to Software DevelopmentIntroduction to Software Development
Introduction to Software Development
 
Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2
 
Overview of VS2010 and .NET 4.0
Overview of VS2010 and .NET 4.0Overview of VS2010 and .NET 4.0
Overview of VS2010 and .NET 4.0
 
Easing offline web application development with GWT
Easing offline web application development with GWTEasing offline web application development with GWT
Easing offline web application development with GWT
 
Android Deep Dive
Android Deep DiveAndroid Deep Dive
Android Deep Dive
 
iOS overview
iOS overviewiOS overview
iOS overview
 
Developing on Windows 8
Developing on Windows 8Developing on Windows 8
Developing on Windows 8
 
The fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose ReactThe fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose React
 
Android Introduction on Java Forum Stuttgart 11
Android Introduction on Java Forum Stuttgart 11 Android Introduction on Java Forum Stuttgart 11
Android Introduction on Java Forum Stuttgart 11
 

Mehr von Maarten Balliauw

Bringing nullability into existing code - dammit is not the answer.pptx
Bringing nullability into existing code - dammit is not the answer.pptxBringing nullability into existing code - dammit is not the answer.pptx
Bringing nullability into existing code - dammit is not the answer.pptxMaarten Balliauw
 
Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...
Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...
Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...Maarten Balliauw
 
Building a friendly .NET SDK to connect to Space
Building a friendly .NET SDK to connect to SpaceBuilding a friendly .NET SDK to connect to Space
Building a friendly .NET SDK to connect to SpaceMaarten Balliauw
 
Indexing and searching NuGet.org with Azure Functions and Search - .NET fwday...
Indexing and searching NuGet.org with Azure Functions and Search - .NET fwday...Indexing and searching NuGet.org with Azure Functions and Search - .NET fwday...
Indexing and searching NuGet.org with Azure Functions and Search - .NET fwday...Maarten Balliauw
 
JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...
JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...
JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...Maarten Balliauw
 
.NET Conf 2019 - Indexing and searching NuGet.org with Azure Functions and Se...
.NET Conf 2019 - Indexing and searching NuGet.org with Azure Functions and Se....NET Conf 2019 - Indexing and searching NuGet.org with Azure Functions and Se...
.NET Conf 2019 - Indexing and searching NuGet.org with Azure Functions and Se...Maarten Balliauw
 
CloudBurst 2019 - Indexing and searching NuGet.org with Azure Functions and S...
CloudBurst 2019 - Indexing and searching NuGet.org with Azure Functions and S...CloudBurst 2019 - Indexing and searching NuGet.org with Azure Functions and S...
CloudBurst 2019 - Indexing and searching NuGet.org with Azure Functions and S...Maarten Balliauw
 
NDC Oslo 2019 - Indexing and searching NuGet.org with Azure Functions and Search
NDC Oslo 2019 - Indexing and searching NuGet.org with Azure Functions and SearchNDC Oslo 2019 - Indexing and searching NuGet.org with Azure Functions and Search
NDC Oslo 2019 - Indexing and searching NuGet.org with Azure Functions and SearchMaarten Balliauw
 
Approaches for application request throttling - Cloud Developer Days Poland
Approaches for application request throttling - Cloud Developer Days PolandApproaches for application request throttling - Cloud Developer Days Poland
Approaches for application request throttling - Cloud Developer Days PolandMaarten Balliauw
 
Indexing and searching NuGet.org with Azure Functions and Search - Cloud Deve...
Indexing and searching NuGet.org with Azure Functions and Search - Cloud Deve...Indexing and searching NuGet.org with Azure Functions and Search - Cloud Deve...
Indexing and searching NuGet.org with Azure Functions and Search - Cloud Deve...Maarten Balliauw
 
Approaches for application request throttling - dotNetCologne
Approaches for application request throttling - dotNetCologneApproaches for application request throttling - dotNetCologne
Approaches for application request throttling - dotNetCologneMaarten Balliauw
 
CodeStock - Exploring .NET memory management - a trip down memory lane
CodeStock - Exploring .NET memory management - a trip down memory laneCodeStock - Exploring .NET memory management - a trip down memory lane
CodeStock - Exploring .NET memory management - a trip down memory laneMaarten Balliauw
 
ConFoo Montreal - Approaches for application request throttling
ConFoo Montreal - Approaches for application request throttlingConFoo Montreal - Approaches for application request throttling
ConFoo Montreal - Approaches for application request throttlingMaarten Balliauw
 
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...Maarten Balliauw
 
DotNetFest - Let’s refresh our memory! Memory management in .NET
DotNetFest - Let’s refresh our memory! Memory management in .NETDotNetFest - Let’s refresh our memory! Memory management in .NET
DotNetFest - Let’s refresh our memory! Memory management in .NETMaarten Balliauw
 
VISUG - Approaches for application request throttling
VISUG - Approaches for application request throttlingVISUG - Approaches for application request throttling
VISUG - Approaches for application request throttlingMaarten Balliauw
 
What is going on - Application diagnostics on Azure - TechDays Finland
What is going on - Application diagnostics on Azure - TechDays FinlandWhat is going on - Application diagnostics on Azure - TechDays Finland
What is going on - Application diagnostics on Azure - TechDays FinlandMaarten Balliauw
 
ConFoo - Exploring .NET’s memory management – a trip down memory lane
ConFoo - Exploring .NET’s memory management – a trip down memory laneConFoo - Exploring .NET’s memory management – a trip down memory lane
ConFoo - Exploring .NET’s memory management – a trip down memory laneMaarten Balliauw
 
ConFoo - NuGet beyond Hello World
ConFoo - NuGet beyond Hello WorldConFoo - NuGet beyond Hello World
ConFoo - NuGet beyond Hello WorldMaarten Balliauw
 
Approaches to application request throttling
Approaches to application request throttlingApproaches to application request throttling
Approaches to application request throttlingMaarten Balliauw
 

Mehr von Maarten Balliauw (20)

Bringing nullability into existing code - dammit is not the answer.pptx
Bringing nullability into existing code - dammit is not the answer.pptxBringing nullability into existing code - dammit is not the answer.pptx
Bringing nullability into existing code - dammit is not the answer.pptx
 
Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...
Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...
Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...
 
Building a friendly .NET SDK to connect to Space
Building a friendly .NET SDK to connect to SpaceBuilding a friendly .NET SDK to connect to Space
Building a friendly .NET SDK to connect to Space
 
Indexing and searching NuGet.org with Azure Functions and Search - .NET fwday...
Indexing and searching NuGet.org with Azure Functions and Search - .NET fwday...Indexing and searching NuGet.org with Azure Functions and Search - .NET fwday...
Indexing and searching NuGet.org with Azure Functions and Search - .NET fwday...
 
JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...
JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...
JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...
 
.NET Conf 2019 - Indexing and searching NuGet.org with Azure Functions and Se...
.NET Conf 2019 - Indexing and searching NuGet.org with Azure Functions and Se....NET Conf 2019 - Indexing and searching NuGet.org with Azure Functions and Se...
.NET Conf 2019 - Indexing and searching NuGet.org with Azure Functions and Se...
 
CloudBurst 2019 - Indexing and searching NuGet.org with Azure Functions and S...
CloudBurst 2019 - Indexing and searching NuGet.org with Azure Functions and S...CloudBurst 2019 - Indexing and searching NuGet.org with Azure Functions and S...
CloudBurst 2019 - Indexing and searching NuGet.org with Azure Functions and S...
 
NDC Oslo 2019 - Indexing and searching NuGet.org with Azure Functions and Search
NDC Oslo 2019 - Indexing and searching NuGet.org with Azure Functions and SearchNDC Oslo 2019 - Indexing and searching NuGet.org with Azure Functions and Search
NDC Oslo 2019 - Indexing and searching NuGet.org with Azure Functions and Search
 
Approaches for application request throttling - Cloud Developer Days Poland
Approaches for application request throttling - Cloud Developer Days PolandApproaches for application request throttling - Cloud Developer Days Poland
Approaches for application request throttling - Cloud Developer Days Poland
 
Indexing and searching NuGet.org with Azure Functions and Search - Cloud Deve...
Indexing and searching NuGet.org with Azure Functions and Search - Cloud Deve...Indexing and searching NuGet.org with Azure Functions and Search - Cloud Deve...
Indexing and searching NuGet.org with Azure Functions and Search - Cloud Deve...
 
Approaches for application request throttling - dotNetCologne
Approaches for application request throttling - dotNetCologneApproaches for application request throttling - dotNetCologne
Approaches for application request throttling - dotNetCologne
 
CodeStock - Exploring .NET memory management - a trip down memory lane
CodeStock - Exploring .NET memory management - a trip down memory laneCodeStock - Exploring .NET memory management - a trip down memory lane
CodeStock - Exploring .NET memory management - a trip down memory lane
 
ConFoo Montreal - Approaches for application request throttling
ConFoo Montreal - Approaches for application request throttlingConFoo Montreal - Approaches for application request throttling
ConFoo Montreal - Approaches for application request throttling
 
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
 
DotNetFest - Let’s refresh our memory! Memory management in .NET
DotNetFest - Let’s refresh our memory! Memory management in .NETDotNetFest - Let’s refresh our memory! Memory management in .NET
DotNetFest - Let’s refresh our memory! Memory management in .NET
 
VISUG - Approaches for application request throttling
VISUG - Approaches for application request throttlingVISUG - Approaches for application request throttling
VISUG - Approaches for application request throttling
 
What is going on - Application diagnostics on Azure - TechDays Finland
What is going on - Application diagnostics on Azure - TechDays FinlandWhat is going on - Application diagnostics on Azure - TechDays Finland
What is going on - Application diagnostics on Azure - TechDays Finland
 
ConFoo - Exploring .NET’s memory management – a trip down memory lane
ConFoo - Exploring .NET’s memory management – a trip down memory laneConFoo - Exploring .NET’s memory management – a trip down memory lane
ConFoo - Exploring .NET’s memory management – a trip down memory lane
 
ConFoo - NuGet beyond Hello World
ConFoo - NuGet beyond Hello WorldConFoo - NuGet beyond Hello World
ConFoo - NuGet beyond Hello World
 
Approaches to application request throttling
Approaches to application request throttlingApproaches to application request throttling
Approaches to application request throttling
 

Kürzlich hochgeladen

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 

Kürzlich hochgeladen (20)

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 

Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo 2020

  • 1. Microservices for building an IDE The innards of JetBrains Rider Maarten Balliauw @maartenballiauw
  • 3. Rider Cross-platform, full-stack .NET IDE All languages, all frameworks Even WinForms (on Windows) Rider C++ in preview Lightweight, fast & yet a full IDE! Built on IntelliJ IDEA and ReSharper Helps you be more productive as a developer Free trial! https://RiderIDE.net/maarten
  • 5. JetBrains Founded 2000 in Prague (Czech Republic) 2000 IntelliJ Renamer 2001 IntelliJ 2004 ReSharper 2020 20+ IDE’s and other developer tools
  • 6.
  • 7. ReSharper IDE Project was halted (but not gone to waste) Keep functionality separate from the actual IDE Same core, IDE interoperability layer on top Visual Studio 2010, 2013, 2015, 2017 and 2019 ReSharper command line tools (CLI) Several concepts and architecture remained
  • 8. “When will JetBrains come with its own .NET IDE?”
  • 9. Why build a .NET IDE? In 2017… “When will JetBrains come with its own .NET IDE?” ReSharper constrained by Visual Studio environment 32-bit process resource constraints Changes in VS impact ReSharper .NET Core No good and consistent cross-platform IDE
  • 10. Cross-platform... ...means a cross-platform UI toolkit is needed! ReSharper UI built with WinForms and WPF Existing ReSharper UI would need converting WinForms? (Mono sort of has it) GTKSharp? Qt?
  • 11. IntelliJ Platform Foundation of all of our IDE’s Project view, code completion, UI toolkit + Platform plugins such as version control, terminal, ... + JetBrains <product name> IDE plugins Open source (build your own IDE – e.g. Android Studio, Comma IDE & others) https://github.com/JetBrains/intellij-community Windows, Linux, Mac – already cross-platform thanks to JVM
  • 12. IntelliJ Platform + R# ? IntelliJ Platform Great foundation to build on Windows, Linux, Mac JVM ReSharper (R#) All of those .NET inspections, refactorings, code generation, project model, ... .NET
  • 13. Options! Rewrite R# in Java? 16 years of implementation and knowledge Would bring 2 R# implementations... Automatic conversion? Run R# as a command-line process Already possible (thanks, 2004!) “Just need our own UI on top”
  • 14. IntelliJ Platform + R# ! Headless R# as a language server Cross-platform (.NET on Windows, .NET Core on macOS/Linux) No constraints It is ReSharper! 2 products, 1 code base IntelliJ as a thin UI Control the R# process
  • 15. Both sides are an IDE... Is IntelliJ IDEA really a thin UI? Three sorts of features... IJ handles everything R# handles almost everything Both IDE’s make a more awesome IDE
  • 16. 1 + 1 = 3 demo
  • 17. How to make them talk? Inter-process communication
  • 18. Example: Context actions (Alt+Enter) IntelliJ Text editor, caret(s) Alt+Enter key binding “Language infrastructure” + C# facade ReSharper C# language, inspections, actions IntelliJ Render actions, may add own entries Data: a tree of id, name and icon nodes
  • 19. 1. Bi-directional User can be typing A refactoring or completion may be injecting code at the same time 2. Can be implemented with delta’s IntelliJ pushes delta to R# R# pushes delta to IntelliJ Can’t really do RPC (user experience would be bad) How to handle concurrency? Data: a delta (from line + column, to line + column, text to insert) Example: Writing code
  • 20. Data types aren’t that complex... Context actions A tree of id, name and icon nodes Inspections A set of name, icon, severity, tooltip, text range Writing code Delta with from line + column, to line + column, text to insert Fairly simple messages! We can make this generic enough! e.g. make one inspection work  make them all work
  • 21. Which protocol do we use? Re-use Language Server Protocol (LSP)? Great in itself – IDE concepts like window, editor, language, diagnostics, ... We would need customizations for R# feature set Or build a custom REST-like protocol? Experimented with JSON, ProtoBuf, request/response style
  • 22. Request-action-response LSP and custom protocol are mostly request/response Every call needs context (which solution, project, file, location in code, ...) Realization: Why use this “request-action-response” flow? Why RPC? Both IDE’s share a similar model and architecture Messages are simple, but for RPC they would need context (which solution, which file, state info, ...) – overhead!
  • 23. Model-View-ViewModel (MVVM) IntelliJ is our view, ReSharper provides the model Protocol is the ViewModel, sharing lightweight data Project.Files.Add("Foo.cs") Project.Files["Foo.cs"].Inspections.Add( "Possible null reference", "Warning", 20, 30, 20, 42); Both processes can react to such change (observable + observer)
  • 24. Conflict resolution... Changes to data in shared model can come from IJ and R# Can still cause conflicts due to features or timing/GC issues IntelliJ: “I just deleted file foo.cs” R#: “I just refactored foo.cs” Solutions! Locking? (freezes, how to handle deadlocks?) Conventions!
  • 25. Conflict conventions! View + Model (or client: IntelliJ + server: ReSharper) Each value stored in the view model has a version Updates by the view/client increment the version Updates by the model/server do not Only accept changes if version is the same or newer If not, the change is discarded
  • 27. Obligatory diagram Ideally, our developers do not have to know the details of this. Just create view models.
  • 28. Rider protocol “Reactive Distributed communication framework for .NET, Kotlin, JS, C++” Open source - https://github.com/jetbrains/rd 1. Include protocol libraries and build tools on all sides 2. Write view model in special DSL 3. Generate code 4. Work with generated model .NET/Kotlin/JS/... code generator Model definition DSL Primitives Conflict resolution, serialization, ... Sockets, batching, binary wire protocol
  • 29. Rider protocol Only need to know about a few data types & create model Conflict resolution, wire protocol, timeouts, ... handled by protocol Code generated based on the defined view model Bonus points: no reflection/introspection needed on every run Hierarchical + lifetimes
  • 30. Primitives Primitive Description Signal Event that is fired when something happens Property Observable value List/set/map Observable collections Field Immutable value Call/callback RPC-style call, needed from time to time byte, short, int, long, float, double, char, boolean, string, securestring, void, enum, ... Primitives and special types Aggregatedef/classdef/structdef A node in the viewmodel
  • 31. Signal (event) Producers/subscribers Observable/observer Using lifetime to manage subscription // Produceevent interfaceISource<T>{ voidFire(T value); } // Subscribetoevent interfaceISink<T> { voidAdvise(Lifetimel,Action<T> handler); } // Event interfaceISignal<T>:ISource<T>,ISink<T> { }
  • 32. Property Signal implementation Lifetime to manage subscription // Observableproperty interfaceIProperty<T>: ISink<T> { T Value{ get;set;} voidAdvise(Lifetimel,Action<T> handler); voidView(Lifetime l,Action<Lifetime,T>handler); }
  • 33. Hierarchical + lifetimes Cleanup and resource management Objects attach to lifetime Lifetime destroys attached objects Parent lifetime destroys children NuGet: JetBrains.Lifetimes publicclassLifetime: IDisposable{ privateStack<Action> resources = newStack<Action>(); publicvoidAttach(Actionresource){ resources.Push(resource); } publicvoidAttach(IDisposabledisposable){ resources.Push(disposable.Dispose); } publicvoidDispose(){ while(resources.Count> 0) { varresource= resources.Pop(); resource(); } } }
  • 34. Hierarchical + lifetimes Solution NuGethost Project Document Inspections PSI (Program StructureInterface) Class Field Method Document Inspections ... Project Local history NuGettool window Project Editor tab Inspections Language Editor tab Inspections Language viewmodel(Riderprotocol)
  • 36. Rider protocol Kotlin-based DSL - easy to work with for our developers Update view model, generate code, work with generated code Find Usages, Navigation, ... work while crafting model No need to think about multiple processes, state, conflict resolution, ... Cross-language, cross-platform Plugin model for Rider is more complex (IJ and R# parts may be needed) https://github.com/JetBrains/fsharp-support https://github.com/JetBrains/resharper-unity https://github.com/JetBrains/azure-tools-for-intellij
  • 38. Two processes! Isolation! Each has their own 64 bit memory space Also their own, separate GC Multi-core machines Start/stop independently
  • 39. Debugging? Four processes. Rider (IntelliJ + ReSharper) Debugger worker process Your application
  • 40. Multiple processes... What if certain features were running in their own process? No need to run all the time Own memory constraints Start/stop/crash independently
  • 41. Shared view model Pass around a shared view model to interested parties Example: Roslyn analyzers/inspections Pass around “reference” of [ { name, icon, severity, tooltip, text range } ]
  • 43. Multiple machines Socket-based wire protocol Sockets can be on multiple machines Example: Docker debugging Remote debugging
  • 44. Unity game engine www.unity3d.com Extension to view model Rider plugin Unity editor plugin https://github.com/JetBrains/resharper-unity https://twitter.com/kskrygan/status/1064950644094705664
  • 47. Model the view as well public CSharpInteractiveOptionsPage(Lifetime lifetime, ...) : base(lifetime, ...) { AddHeader("Tool settings"); AddToolPathFileChooserOption(lifetime, commonFileDialogs); AddEmptyLine(); AddStringOption((CSIOptions s) => s.ToolArguments, "Tool arguments:", "Additional tool arguments"); AddHeader("Tool window behavior"); AddBoolOption((CSIOptions s) => s.FocusOnOpenToolWindow, "Focus tool window on open"); AddBoolOption((CSIOptions s) => s.FocusOnSendLineText, "Focus tool window on Send Line"); AddBoolOption((CSIOptions s) => s.MoveCaretOnSendLineText, "Move caret down on Send Line"); // ... }
  • 48. Multiple machines WPF on macOS/Linux Rendering on Windows Front-end on one machine, back-end on another ...
  • 49. Every IDE as both a client and server Front-end and back-end: separate process & memory Whatever happens in the backend, the frontend can process the user's typing Bring this technology to other IDE’s? Reuse WebStorm's HTML/CSS/JS functionality in ReSharper (e.g. Visual Studio + R# using WebStorm in back-end mode)
  • 51. Conclusion Rider is an IDE built on two IDE’s two technology stacks Rich and easy programming model was needed to bridge the two Protocol gave rise to more than two processes more than one machine micro UI Free trial! www.jetbrains.com/rider

Hinweis der Redaktion

  1. This talk is about: How Rider came to be How protocol allowed us to gain additional knowledge and ideas of separating parts of our IDEs and building TOWARDS microservices This talk is also about building a new product based on many years of previous investments
  2. Open ContosoUniversity in Rider Show solution explorer Show editor where you can type, show inspections, navigation, refactoring Mention debugging Mention tools like database Mention cross platform
  3. Now that we have seen a bit of the IDE, let’s look at some history first.
  4. Talk about history of JetBrains a bit, mention Eclipse in 2002, need for a new product. Mention ReSharper plugin to VS..
  5. ReSharper 1.0 -> 2.0 – let’s do a full IDE Rely on being a plugin to VS? Or build a full .NET IDE? It was never released, but a fully functional prototype. Provided a solution explorer, an editor, find usages, code completion and refactorings. Built on .NET WinForms and Windows Presentation Foundation (WPF) wasn’t around. Project halted – VS plugin seemed best way to go
  6. Project halted (but not gone to waste) Concepts and architecture remained Action system Text control implementation Several tool windows and toolbar controls Unit test runner ReSharper command line tools (CLI) Keep functionality separate from the actual IDE Helped future versions of ReSharper: Visual Studio 2010, 2013, 2015 and 2017 Same core, IDE interoperability layer on top
  7. Headless R# as a language server Cross-platform (.NET on Windows, Mono on Linux and macOS) No constraints (64 bit process, and its own memory space) It is ReSharper! 2 products, 1 code base IntelliJ as a thin UI Control the R# process Client/server or IPC communication
  8. Is IntelliJ really a thin UI? Full IDE for its own languages, no need for R# there Combined languages (e.g. JS/TS/HTML in IJ and R#) Change tracking, VCS, REST client, tool windows, ... Three cases... Features where IJ handles everything Features where R# handles almost everything Features where both IDE’s make an awesome IDE Both sides are an IDE! Same concepts, but not the same knowledge about the project
  9. Open ContosoUniversity in Rider Navigate to *.html – Navigation already includes all flows! Files in IJ, symbols in IJ, symbols in R# HTML editor is purely IntelliJ Navigate to *.cshtml – Again both IDE’s at work CSHTML is both C# and HTML – now what? Both IDE’s! Navigate to HomeController C# is al ReSharper. Or is it? Show database tools + language injection with database query. Mention local history – tracked by IJ but R# needs to know about this too, e.g. in a big refactoring
  10. If we are going to make them talk, let’s look at how we could model the data that goes over the wire.
  11. Re-use Language Server Protocol (LSP)? Great in itself – IDE concepts like window, editor, language, diagnostics, ... Built for/with VS Code and the ideas in that IDE. Not bad! PoSh plugin uses this, and works fine! But feature set is a bit more limited than what we have in R#. We would need customizations... LSP is lowest common denominator – some R# refactorings can not be done Mixed languages? e.g. CSHTML which can be HTML + CSS + JS + C#/VB.NET Build a custom REST-like protocol? Experimented with JSON, ProtoBuf, request/response style Slow, hard to customize, hard to develop with when all is in motion
  12. Objects bind to other objects, instead of parent keeping track of just direct children
  13. Open empty project in Rider, install a NuGet package, show log tab Open Rider in IntelliJ IDEA NuGetModel.kt – explain it Extends the solution node in the model Has a bunch of inner classes, and properties Interesting is sink(“log”) Generated version: RdNuGetHost – Kotlin implementation of our view model In RiderNuGetLogPanel – init -> facade.host.log.advise(facade.lifetime) Open ReSharperHost.Generated.sln in Rider Generated version: RdNuGetHost – C# implementation of our model In NuGetNativeLogger, public override void Log(ILogMessage message) => myHost.Log.Fire( new NuGetLogMessage(message.Time, NuGetLogContext.NuGet, Convert(message.Level), message.Message)); Open Rider in IntelliJ IDEA NuGetModel.kt – find property("configFiles", immutableList(classdef("RdNuGetConfigFile") { RiderNuGetSourcesPanel – init - facade.host.configManager.configFiles.advise(facade.lifetime) { newFiles -> Similar construct to subscribe to sources being added to the view model Open ReSharperHost.Generated.sln in Rider In NuGetCredentialProviderHost, show lifetime example – when solution closes the lifetime closes, so this thing cleans up as well
  14. Mention WPF, WinForms
  15. Thought experiments: WPF/XAML renderer
  16. Rider and Unity Editor can be started independently, but this does not prevent us from both processes to look for each other’s Rider Protocol connection. When both are launched and the connection is allowed, Rider can share its view model with Unity Editor and vice-versa. This lets Rider control play/pause/and stop buttons in Unity, and also provides the ability to debug code in Rider, even though it is running in the Unity Editor.
  17. Rider and Unity Editor can be started independently, but this does not prevent us from both processes to look for each other’s Rider Protocol connection. When both are launched and the connection is allowed, Rider can share its view model with Unity Editor and vice-versa. This lets Rider control play/pause/and stop buttons in Unity, and also provides the ability to debug code in Rider, even though it is running in the Unity Editor.
  18. Also way forward with R# OOP
  19. Thought experiments: WPF/XAML renderer