Skip to content
GitLab
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
    Projects Groups Topics Snippets
  • Register
  • Sign in
  • lfortran lfortran
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 432
    • Issues 432
    • List
    • Boards
    • Service Desk
    • Milestones
    • Requirements
  • Merge requests 72
    • Merge requests 72
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
    • Model experiments
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • lfortranlfortran
  • lfortranlfortran
  • Issues
  • #12
Closed
Open
Issue created Nov 07, 2017 by Ondřej Čertík@certikOwner

Implement "Language Service"

Implement a "Language Service", which is a server exposing a JSON based API that accepts user cursor movement and each character changes. It brings back, e.g., a list of members for the editor to show.

How it works:

  • Each source file gets compiled to AST.
    • If a source file does not change, the AST does not change. AST is immutable. Type annotations are kept in a separate hash table.
    • If a source file changes at a place, only that node at the given place and all parent nodes must change (in the direct line to the root), but all other nodes in the file can be reused and hooked in. This saves time to reconstruct the AST
  • The AST is thus always available and ready.
  • Type annotations must be redone, since some base type can change in a file, and all modules that depend on it can change their type annotations too. The AST however does not change. In Fortran, a given module can be fully compiled if just the symbol table is known. So given a symbol table, one must redo type annotations for all AST trees of all modules.
  • The type annotations are slow in general, so they work on the "pull" basis --- for a given symbol, one can figure out a type by going over the parents, and the rest of types are not computed.
  • For a source file change, the mentality is to "start over". The type annotations are erased (but perhaps can be reused in some fashion to build the new annotations). The AST is only changed in one file at a time, and one can greatly reuse the AST tree in there too, as described above.

Typescript does it:

https://github.com/Microsoft/TypeScript/wiki/Architectural-Overview

C# also has it:

https://github.com/dotnet/roslyn https://msdn.microsoft.com/en-us/magazine/dn879356 https://github.com/dotnet/roslyn/wiki/Syntax%20Visualizer

Clang has it: https://github.com/llvm-mirror/clang-tools-extra/tree/master/clangd

There seems to be a standard now: https://en.wikipedia.org/wiki/Language_Server_Protocol, and it is supported, e.g., by https://en.wikipedia.org/wiki/Visual_Studio_Code.

Edited Nov 07, 2017 by Ondřej Čertík
Assignee
Assign to
Time tracking