Skip to content

Commit

Permalink
Merge pull request #7039 from apache/delivery
Browse files Browse the repository at this point in the history
Sync delivery to release210 for 21-rc3 (part two)
  • Loading branch information
neilcsmith-net committed Feb 8, 2024
2 parents 115308a + 6317844 commit b15c9b7
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 5 deletions.
1 change: 1 addition & 0 deletions extide/gradle/netbeans-gradle-tooling/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ mainClassName = 'org.netbeans.modules.gradle.DebugTooling'

sourceCompatibility = '1.8'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
[compileJava, compileTestJava]*.options*.debug = true

repositories {
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion extide/gradle/netbeans-gradle-tooling/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</target>
<target name="compile" depends="prepare-libs">
<mkdir dir="build/classes/java/main"/>
<javac srcdir="src/main/java" destdir="build/classes/java/main" classpathref="compile.classpath" release="8" includeantruntime="false"/>
<javac srcdir="src/main/java" destdir="build/classes/java/main" classpathref="compile.classpath" release="8" includeantruntime="false" debug="true"/>
</target>

<target name="jar" depends="compile">
Expand Down
4 changes: 2 additions & 2 deletions java/java.lsp.server/vscode/src/nbcode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ export function launch(
ideArgs.push('-J-Dnetbeans.logger.console=true');
}
ideArgs.push(`-J-Dnetbeans.extra.dirs=${clusterPath}`)
if (env['netbeans.extra.options']) {
ideArgs.push(...env['netbeans.extra.options'].split(' '));
if (env['netbeans_extra_options']) {
ideArgs.push(...env['netbeans_extra_options'].split(' '));
}
ideArgs.push(...extraArgs);
if (env['netbeans_debug'] && extraArgs && extraArgs.find(s => s.includes("--list"))) {
Expand Down
2 changes: 1 addition & 1 deletion java/java.lsp.server/vscode/src/test/runTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async function main() {
extensionTestsPath,
extensionTestsEnv: {
'ENABLE_CONSOLE_LOG' : 'true',
"netbeans.extra.options" : `-J-Dproject.limitScanRoot=${outRoot} -J-Dnetbeans.logger.console=true`
"netbeans_extra_options" : `-J-Dproject.limitScanRoot=${outRoot} -J-Dnetbeans.logger.console=true`
},
launchArgs: [
'--disable-extensions',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1662,6 +1662,7 @@ private static boolean isInMatchExpression(final int caretOffset, final TokenSeq
}

static boolean isInAttribute(final int caretOffset, final TokenSequence ts, boolean allowInArgs) {
final int originalOffset = ts.offset();
// e.g. #[MyAttr^ibute] ("^": caret)
boolean result = false;
int bracketBalance = 0;
Expand Down Expand Up @@ -1693,7 +1694,7 @@ static boolean isInAttribute(final int caretOffset, final TokenSequence ts, bool
break;
}
}
ts.move(caretOffset);
ts.move(originalOffset);
ts.moveNext();
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1671,6 +1671,9 @@ private void autoCompleteConstructorParameterName(final PHPCompletionResult comp
if (tokenSequence == null) {
return;
}
if (!tokenSequence.moveNext()) {
return;
}
if (CompletionContextFinder.isInAttribute(request.anchor, tokenSequence, true)) {
autoCompleteAttributeExpression(completionResult, request);
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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
*
* http://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.
*/

namespace TestA;

function myFunction(): void {
}

namespace TestB;

use function TestA\myFunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Code completion result for source line:
use function TestA\myFunction|
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
METHOD myFunction() [PUBLIC] TestA
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.netbeans.modules.php.editor.completion;

import java.io.File;
import org.netbeans.modules.parsing.spi.ParseException;
import org.netbeans.modules.php.api.PhpVersion;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
Expand Down Expand Up @@ -1672,4 +1673,11 @@ public void testAttributesPredefined_01() throws Exception {
checkCompletion(getTestPath(), " #[^]", false);
}

public void testParseException() throws Exception {
try {
checkCompletion(getTestPath(), "use function TestA\\myFunction^", false);
} catch (ParseException e) {
fail("Must not throw ParseException.");
}
}
}

0 comments on commit b15c9b7

Please sign in to comment.