Merge branch 'main' into feature/cross-package-typescript-references

# Conflicts:
#	CHANGELOG.md
#	src/solidlsp/ls.py
This commit is contained in:
Michael Panchenko committed 2026-05-04 14:26:20 +02:00
commit 64e604630e
216 files changed
+7868 -1189

No files matched your search

@@ -0,0 +1,4 @@
#!/usr/bin/env bash
if then
echo "$missingGreeting"
fi
@@ -0,0 +1,9 @@
(ns test-app.diagnostics-sample)
(defn broken-factory []
missing-greeting)
(defn broken-consumer []
(let [value (broken-factory)]
(println value)
missing-consumer-value))
@@ -8,5 +8,10 @@
"directory": ".",
"command": "g++ -std=c++17 -I . -c b.cpp",
"file": "b.cpp"
},
{
"directory": ".",
"command": "g++ -std=c++17 -I . -c diagnostics_sample.cpp",
"file": "diagnostics_sample.cpp"
}
]
]
@@ -0,0 +1,8 @@
int brokenFactory() {
return missingGreeting;
}
int brokenConsumer() {
int value = brokenFactory();
return value + missingConsumerValue;
}
@@ -0,0 +1,5 @@
def broken_factory : String
missingGreeting
end
broken_consumer = missingConsumerValue
@@ -0,0 +1,19 @@
using System;
namespace TestProject
{
public static class DiagnosticsSample
{
public static string BrokenFactory()
{
return missingGreeting;
}
public static void BrokenConsumer()
{
string value = BrokenFactory();
Console.WriteLine(value);
Console.WriteLine(missingConsumerValue);
}
}
}
@@ -1,4 +1,5 @@
using System;
using TestProject.Services;
namespace TestProject
{
@@ -7,10 +8,13 @@ namespace TestProject
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
var calculator = new Calculator();
int result = calculator.Add(5, 3);
Console.WriteLine($"5 + 3 = {result}");
IGreeter greeter = new ConsoleGreeter();
Console.WriteLine(greeter.FormatGreeting("World"));
}
}
@@ -40,4 +44,4 @@ namespace TestProject
return (double)a / b;
}
}
}
}
@@ -0,0 +1,10 @@
namespace TestProject.Services
{
public class ConsoleGreeter : IGreeter
{
public string FormatGreeting(string name)
{
return $"Hello, {name}!";
}
}
}
@@ -0,0 +1,7 @@
namespace TestProject.Services
{
public interface IGreeter
{
string FormatGreeting(string name);
}
}
@@ -0,0 +1,3 @@
String brokenFactory() {
return 'broken'
}
@@ -0,0 +1,10 @@
defmodule DiagnosticsSample do
def broken_factory do
missing_greeting
end
def broken_consumer do
value = broken_factory()
{value, missing_consumer_value}
end
end
@@ -0,0 +1,5 @@
module DiagnosticsSample exposing (brokenFactory)
brokenFactory : String
brokenFactory =
"unterminated
@@ -0,0 +1,5 @@
-module(diagnostics_sample).
-export([broken_factory/0, broken_consumer/0]).
broken_factory() -> MissingGreeting.
broken_consumer() -> MissingConsumerValue.
@@ -0,0 +1,5 @@
program diagnostics_sample
implicit none
integer :: duplicated_value
real :: duplicated_value
end program diagnostics_sample
@@ -0,0 +1,11 @@
module DiagnosticsSample
let brokenConsumerValue = 1
let brokenFactory () =
missingGreeting
let brokenConsumer () =
let value = brokenFactory ()
printfn "%A" value
missingConsumerValue
@@ -0,0 +1,8 @@
module Formatter
type IGreeter =
abstract member FormatGreeting: string -> string
type ConsoleGreeter() =
interface IGreeter with
member _.FormatGreeting(name: string) = sprintf "Hello, %s!" name
@@ -1,7 +1,9 @@
module Program
open Calculator
open Formatter
open Models
open Shapes
[<EntryPoint>]
let main argv =
@@ -24,6 +26,12 @@ let main argv =
let calc = CalculatorClass()
let classResult = calc.Add(20, 5)
printfn "Calculator class: 20 + 5 = %d" classResult
let greeter: IGreeter = ConsoleGreeter() :> IGreeter
printfn "%s" (greeter.FormatGreeting("World"))
let shape: Shape = Circle(2.0) :> Shape
printfn "Area: %.2f" (shape.Area())
// Test person module
let person = PersonModule.createPerson "Alice Smith" 25 (Some "alice@example.com")
@@ -34,4 +42,4 @@ let main argv =
let fact5 = factorial 5
printfn "5! = %d" fact5
0 // return success
0 // return success
@@ -0,0 +1,10 @@
module Shapes
[<AbstractClass>]
type Shape() =
abstract member Area: unit -> float
type Circle(radius: float) =
inherit Shape()
override _.Area() = System.Math.PI * radius * radius
@@ -7,8 +7,11 @@
<ItemGroup>
<Compile Include="Calculator.fs" />
<Compile Include="DiagnosticsSample.fs" />
<Compile Include="Formatter.fs" />
<Compile Include="Shapes.fs" />
<Compile Include="Models/Person.fs" />
<Compile Include="Program.fs" />
</ItemGroup>
</Project>
</Project>
@@ -0,0 +1,11 @@
package main
func brokenFactory() string {
return missingGreeting
}
func brokenConsumer() {
value := brokenFactory()
_ = value
_ = missingConsumerValue
}
+12
View File
@@ -5,6 +5,8 @@ import "fmt"
func main() {
fmt.Println("Hello, Go!")
Helper()
var greeter Greeter = ConsoleGreeter{}
fmt.Println(greeter.FormatGreeting("Go"))
}
func Helper() {
@@ -22,3 +24,13 @@ func (d *DemoStruct) Value() int {
func UsingHelper() {
Helper()
}
type Greeter interface {
FormatGreeting(name string) string
}
type ConsoleGreeter struct{}
func (ConsoleGreeter) FormatGreeting(name string) string {
return "Hello, " + name + "!"
}
@@ -0,0 +1,13 @@
package com.example
class DiagnosticsSample {
static String brokenFactory() {
missingGreeting
}
static void brokenConsumer() {
def value = brokenFactory()
println(value)
println(missingConsumerValue)
}
}
@@ -0,0 +1,7 @@
module DiagnosticsSample where
brokenFactory :: String
brokenFactory = missingGreeting
brokenConsumer :: String
brokenConsumer = missingConsumerValue
@@ -0,0 +1,10 @@
class DiagnosticsSample {
static function brokenFactory():String {
return missingGreeting;
}
static function brokenConsumer():Void {
trace(brokenFactory());
trace(missingConsumerValue);
}
}
@@ -0,0 +1,3 @@
float4 main() : SV_Target {
return missingGreeting;
}
@@ -0,0 +1,8 @@
package test_repo;
public class ConsoleGreeter implements Greeter {
@Override
public String formatGreeting(String name) {
return "Hello, " + name + "!";
}
}
@@ -0,0 +1,13 @@
package test_repo;
public class DiagnosticsSample {
public static String brokenFactory() {
return missingGreeting;
}
public static void brokenConsumer() {
String value = brokenFactory();
System.out.println(value);
System.out.println(missingConsumerValue);
}
}
@@ -0,0 +1,5 @@
package test_repo;
public interface Greeter {
String formatGreeting(String name);
}
@@ -6,6 +6,8 @@ public class Main {
Model model = new Model("Cascade");
System.out.println(model.getName());
acceptModel(model);
Greeter greeter = new ConsoleGreeter();
System.out.println(greeter.formatGreeting("Cascade"));
}
public static void acceptModel(Model m) {
// Do nothing, just for LSP reference
@@ -0,0 +1,4 @@
{
"name": "diagnostics",
"value":
}
@@ -0,0 +1,3 @@
function broken_factory(
value = 1
end
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
+251
View File
@@ -0,0 +1,251 @@
#!/bin/sh
#
# Copyright © 2015 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"
+94
View File
@@ -0,0 +1,94 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
@@ -0,0 +1,11 @@
package test_repo
fun brokenFactory(): String {
return missingGreeting
}
fun brokenConsumer() {
val value = brokenFactory()
println(value)
println(missingConsumerValue)
}
@@ -0,0 +1 @@
def brokenFactory : Nat :=
+10 -1
View File
@@ -3,6 +3,7 @@
-- main.lua: Entry point for the test application
local calculator = require("src.calculator")
local animals = require("src.animals")
local utils = require("src.utils")
local function print_banner()
@@ -50,6 +51,12 @@ local function test_utils()
logger:warn("This is a warning")
end
local function test_animals()
print("\nTesting Animal Module:")
local dog = animals.Dog:new("Rex")
print(dog:speak())
end
local function interactive_calculator()
print("\nInteractive Calculator (type 'quit' to exit):")
while true do
@@ -99,11 +106,13 @@ local function main(args)
if #args == 0 then
test_calculator()
test_utils()
test_animals()
elseif args[1] == "interactive" then
interactive_calculator()
elseif args[1] == "test" then
test_calculator()
test_utils()
test_animals()
print("\nAll tests completed!")
else
print("Usage: lua main.lua [interactive|test]")
@@ -111,4 +120,4 @@ local function main(args)
end
-- Run main function
main(arg or {})
main(arg or {})
@@ -0,0 +1,37 @@
---@class Animal
local Animal = {}
Animal.__index = Animal
---@param name string
---@return Animal
function Animal:new(name)
local self = setmetatable({}, Animal)
self.name = name
return self
end
---@return string
function Animal:speak()
return self.name .. " makes a sound"
end
---@class Dog: Animal
local Dog = setmetatable({}, { __index = Animal })
Dog.__index = Dog
---@param name string
---@return Dog
function Dog:new(name)
local self = Animal.new(self, name)
return setmetatable(self, Dog)
end
---@return string
function Dog:speak()
return self.name .. " says woof"
end
return {
Animal = Animal,
Dog = Dog,
}
@@ -0,0 +1,3 @@
function value = diagnostics_sample()
value = missingGreeting;
end
@@ -0,0 +1,4 @@
{
greeting = missingGreeting;
consumer = missingConsumerValue;
}
@@ -0,0 +1 @@
let broken_factory (
@@ -1,3 +1,4 @@
(library
(public_name test_repo)
(name test_repo))
(name test_repo)
(modules test_repo))
@@ -0,0 +1,4 @@
program DiagnosticsSample;
begin
writeln(
end.
@@ -0,0 +1,5 @@
use strict;
use warnings;
print $missingGreeting;
print $missingConsumerValue;
@@ -0,0 +1,11 @@
<?php
function brokenFactory(): string {
return $missingGreeting;
}
function brokenConsumer(): void {
$value = brokenFactory();
echo $value;
echo $missingConsumerValue;
}
@@ -0,0 +1,4 @@
function Invoke-BrokenFactory {
if ($true) {
Write-Output "broken"
}
@@ -0,0 +1,11 @@
from .models import User
def broken_factory() -> User:
return missing_user
def broken_consumer() -> None:
created_user = broken_factory()
print(created_user)
print(undefined_name)
@@ -7,3 +7,15 @@ class Calculator
a - b
end
end
class Greeter
def format_greeting(name)
name
end
end
class ConsoleGreeter < Greeter
def format_greeting(name)
"Hello, #{name}!"
end
end
@@ -15,6 +15,8 @@ end
def helper_function(number = 42)
demo = DemoClass.new(number)
Calculator.new.add(demo.value, 10)
greeter = ConsoleGreeter.new
puts greeter.format_greeting("Ruby")
demo.print_value
end
@@ -0,0 +1,9 @@
pub fn broken_factory() -> String {
missing_greeting
}
pub fn broken_consumer() {
let value = broken_factory();
println!("{value}");
println!("{}", missing_consumer_value);
}
@@ -1,3 +1,5 @@
pub mod diagnostics_sample;
// This function returns the sum of 2 + 2
pub fn add() -> i32 {
let res = 2 + 2;
@@ -7,3 +9,15 @@ pub fn multiply() -> i32 {
2 * 3
}
pub trait Greeter {
fn format_greeting(&self, name: &str) -> String;
}
pub struct ConsoleGreeter;
impl Greeter for ConsoleGreeter {
fn format_greeting(&self, name: &str) -> String {
format!("Hello, {name}!")
}
}
@@ -1,8 +1,10 @@
use rsandbox::add;
use rsandbox::{add, ConsoleGreeter, Greeter};
fn main() {
println!("Hello, World!");
println!("Good morning!");
println!("add result: {}", add());
let greeter = ConsoleGreeter;
println!("{}", greeter.format_greeting("Rust"));
println!("inserted line");
}
@@ -0,0 +1,9 @@
package com.example
object DiagnosticsSample {
def brokenFactory(): String = missingGreeting
def brokenConsumer(): Unit = {
println(brokenFactory())
println(missingConsumerValue)
}
}
@@ -0,0 +1,7 @@
pragma solidity ^0.8.0;
contract DiagnosticsSample {
function brokenFactory() pure returns (string memory) {
return "broken";
}
}
@@ -11,6 +11,7 @@ let package = Package(
targets: [
.target(
name: "test_repo",
dependencies: []),
dependencies: [],
path: "src"),
]
)
)
@@ -0,0 +1,3 @@
func brokenFactory() -> String {
return
}
@@ -0,0 +1,5 @@
module diagnostics_sample;
initial begin
if (
end
endmodule
@@ -0,0 +1,4 @@
resource "aws_instance" "broken" {
ami =
instance_type = "t2.micro"
}
@@ -0,0 +1,2 @@
[diagnostics]
value =
@@ -1,7 +1,153 @@
# list of tool names to exclude.
# This extends the existing exclusions (e.g. from the global configuration)
#
# Below is the complete list of tools for convenience.
# To make sure you have the latest list of tools, and to view their descriptions,
# execute `uv run scripts/print_tool_overview.py`.
#
# * `activate_project`: Activates a project by name.
# * `check_onboarding_performed`: Checks whether project onboarding was already performed.
# * `create_text_file`: Creates/overwrites a file in the project directory.
# * `delete_lines`: Deletes a range of lines within a file.
# * `delete_memory`: Deletes a memory from Serena's project-specific memory store.
# * `execute_shell_command`: Executes a shell command.
# * `find_referencing_code_snippets`: Finds code snippets in which the symbol at the given location is referenced.
# * `find_referencing_symbols`: Finds symbols that reference the symbol at the given location (optionally filtered by type).
# * `find_symbol`: Performs a global (or local) search for symbols with/containing a given name/substring (optionally filtered by type).
# * `get_current_config`: Prints the current configuration of the agent, including the active and available projects, tools, contexts, and modes.
# * `get_symbols_overview`: Gets an overview of the top-level symbols defined in a given file.
# * `initial_instructions`: Gets the initial instructions for the current project.
# Should only be used in settings where the system prompt cannot be set,
# e.g. in clients you have no control over, like Claude Desktop.
# * `insert_after_symbol`: Inserts content after the end of the definition of a given symbol.
# * `insert_at_line`: Inserts content at a given line in a file.
# * `insert_before_symbol`: Inserts content before the beginning of the definition of a given symbol.
# * `list_dir`: Lists files and directories in the given directory (optionally with recursion).
# * `list_memories`: Lists memories in Serena's project-specific memory store.
# * `onboarding`: Performs onboarding (identifying the project structure and essential tasks, e.g. for testing or building).
# * `prepare_for_new_conversation`: Provides instructions for preparing for a new conversation (in order to continue with the necessary context).
# * `read_file`: Reads a file within the project directory.
# * `read_memory`: Reads the memory with the given name from Serena's project-specific memory store.
# * `remove_project`: Removes a project from the Serena configuration.
# * `replace_lines`: Replaces a range of lines within a file with new content.
# * `replace_symbol_body`: Replaces the full definition of a symbol.
# * `restart_language_server`: Restarts the language server, may be necessary when edits not through Serena happen.
# * `search_for_pattern`: Performs a search for a pattern in the project.
# * `summarize_changes`: Provides instructions for summarizing the changes made to the codebase.
# * `switch_modes`: Activates modes by providing a list of their names
# * `think_about_collected_information`: Thinking tool for pondering the completeness of collected information.
# * `think_about_task_adherence`: Thinking tool for determining whether the agent is still on track with the current task.
# * `think_about_whether_you_are_done`: Thinking tool for determining whether the task is truly completed.
# * `write_memory`: Writes a named memory (for future reference) to Serena's project-specific memory store.
excluded_tools: []
# whether to use project's .gitignore files to ignore files
ignore_all_files_in_gitignore: true
# list of additional paths to ignore in this project.
# Same syntax as gitignore, so you can use * and **.
# Note: global ignored_paths from serena_config.yml are also applied additively.
ignored_paths: []
# initial prompt for the project. It will always be given to the LLM upon activating the project
# (contrary to the memories, which are loaded on demand).
initial_prompt: ''
language: typescript
# the name by which the project can be referenced within Serena
project_name: test_repo
# whether the project is in read-only mode
# If set to true, all editing tools will be disabled and attempts to use them will result in an error
# Added on 2025-04-18
read_only: false
# list of tools to include that would otherwise be disabled (particularly optional tools that are disabled by default).
# This extends the existing inclusions (e.g. from the global configuration).
included_optional_tools: []
# fixed set of tools to use as the base tool set (if non-empty), replacing Serena's default set of tools.
# This cannot be combined with non-empty excluded_tools or included_optional_tools.
fixed_tools: []
# list of mode names to that are always to be included in the set of active modes
# The full set of modes to be activated is base_modes + default_modes.
# If the setting is undefined, the base_modes from the global configuration (serena_config.yml) apply.
# Otherwise, this setting overrides the global configuration.
# Set this to [] to disable base modes for this project.
# Set this to a list of mode names to always include the respective modes for this project.
base_modes:
# list of mode names that are to be activated by default.
# The full set of modes to be activated is base_modes + default_modes.
# If the setting is undefined, the default_modes from the global configuration (serena_config.yml) apply.
# Otherwise, this overrides the setting from the global configuration (serena_config.yml).
# This setting can, in turn, be overridden by CLI parameters (--mode).
default_modes:
# time budget (seconds) per tool call for the retrieval of additional symbol information
# such as docstrings or parameter information.
# This overrides the corresponding setting in the global configuration; see the documentation there.
# If null or missing, use the setting from the global configuration.
symbol_info_budget:
# The language backend to use for this project.
# If not set, the global setting from serena_config.yml is used.
# Valid values: LSP, JetBrains
# Note: the backend is fixed at startup. If a project with a different backend
# is activated post-init, an error will be returned.
language_backend:
# line ending convention to use when writing source files.
# Possible values: unset (use global setting), "lf", "crlf", or "native" (platform default)
# This does not affect Serena's own files (e.g. memories and configuration files), which always use native line endings.
line_ending:
# list of regex patterns which, when matched, mark a memory entry as read‑only.
# Extends the list from the global configuration, merging the two lists.
read_only_memory_patterns: []
# list of regex patterns for memories to completely ignore.
# Matching memories will not appear in list_memories or activate_project output
# and cannot be accessed via read_memory or write_memory.
# To access ignored memory files, use the read_file tool on the raw file path.
# Extends the list from the global configuration, merging the two lists.
# Example: ["_archive/.*", "_episodes/.*"]
ignored_memory_patterns: []
# advanced configuration option allowing to configure language server-specific options.
# Maps the language key to the options.
# Have a look at the docstring of the constructors of the LS implementations within solidlsp (e.g., for C# or PHP) to see which options are available.
# No documentation on options means no options are available.
ls_specific_settings: {}
# the encoding used by text files in the project
# For a list of possible encodings, see https://docs.python.org/3.11/library/codecs.html#standard-encodings
encoding: utf-8
# list of languages for which language servers are started; choose from:
# al bash clojure cpp csharp
# csharp_omnisharp dart elixir elm erlang
# fortran fsharp go groovy haskell
# java julia kotlin lua markdown
# matlab nix pascal perl php
# php_phpactor powershell python python_jedi python_ty
# r
# rego ruby ruby_solargraph rust scala
# swift terraform toml typescript typescript_vts
# vue yaml zig
# (This list may be outdated. For the current list, see values of Language enum here:
# https://github.com/oraios/serena/blob/main/src/solidlsp/ls_config.py
# For some languages, there are alternative language servers, e.g. csharp_omnisharp, ruby_solargraph.)
# Note:
# - For C, use cpp
# - For JavaScript, use typescript
# - For Free Pascal/Lazarus, use pascal
# Special requirements:
# Some languages require additional setup/installations.
# See here for details: https://oraios.github.io/serena/01-about/020_programming-languages.html#language-servers
# When using multiple languages, the first language server that supports a given file will be used for that file.
# The first language is the default language and the respective language server will be used as a fallback.
# Note that when using the JetBrains backend, language servers are not used and this list is correspondingly ignored.
languages:
- typescript
@@ -0,0 +1,9 @@
export function brokenFactory(): string {
return missingGreeting;
}
export function brokenConsumer(): void {
const value = brokenFactory();
console.log(value);
console.log(missingConsumerValue);
}
@@ -0,0 +1,9 @@
export interface Greeter {
formatGreeting(name: string): string;
}
export class ConsoleGreeter implements Greeter {
formatGreeting(name: string): string {
return `Hello, ${name}!`;
}
}
@@ -1,3 +1,5 @@
import { ConsoleGreeter, Greeter } from "./formatters";
export class DemoClass {
value: number;
constructor(value: number) {
@@ -11,6 +13,9 @@ export class DemoClass {
export function helperFunction() {
const demo = new DemoClass(42);
demo.printValue();
const greeter: Greeter = new ConsoleGreeter();
console.log(greeter.formatGreeting("World"));
}
helperFunction();
@@ -0,0 +1,44 @@
// Regression fixture: mirrors the real-world pattern that caused
// languageId=typescript (instead of typescriptreact) to truncate symbol
// ranges at the first multi-line JSX expression.
import * as React from "react"
type SectionProps = { title: string; emphasised?: boolean }
function Section({ title, emphasised }: SectionProps) {
return emphasised ? (
<h1 style={{ color: "red" }}>{title}</h1>
) : (
<h2 style={{ color: "gray" }}>{title}</h2>
)
}
export function JsxComponent({ heading, items }: { heading: string; items: string[] }) {
const renderHeader = (title: string) =>
title.length > 10 ? (
<Section title={title} emphasised />
) : (
<Section title={title} />
)
// The truncation bug used to cut JsxComponent's range right around here,
// hiding everything below from find_symbol. Keep this comment so the
// regression test can assert the function body extends past it.
const renderItem = (item: string, idx: number) => (
<li key={idx} style={{ marginBottom: 4 }}>
{item}
</li>
)
return (
<div>
{renderHeader(heading)}
<ul>{items.map(renderItem)}</ul>
</div>
)
}
export function trailingHelper(): string {
return "this symbol is invisible to find_symbol when JsxComponent's range is truncated"
}
@@ -5,7 +5,8 @@
"strict": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true
"skipLibCheck": true,
"jsx": "react"
},
"include": ["**/*.ts"]
"include": ["**/*.ts", "**/*.tsx"]
}
@@ -0,0 +1,3 @@
<script setup lang="ts">
const value: string =
</script>
@@ -0,0 +1,5 @@
name: diagnostics
value:
- good
-
broken: [
+1 -1
View File
@@ -28,4 +28,4 @@ pub fn build(b: *std.Build) void {
const run_lib_tests = b.addRunArtifact(lib_tests);
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&run_lib_tests.step);
}
}
@@ -0,0 +1,3 @@
pub fn brokenFactory() void {
const value =
}
@@ -29,4 +29,4 @@ pub fn main() !void {
pub fn greeting(name: []const u8) []const u8 {
return std.fmt.allocPrint(std.heap.page_allocator, "Hello, {s}!", .{name}) catch "Hello!";
}
}